Skip to main content
Version: 1.0.x

Flow Example

In this example, the flow captures HTTP transaction logs for a specific API endpoint and exports them using the configured File Exporter.

Example Configuration

/etc/lunar-proxy/flows/flow.yaml
name: HARCollectorFlow

filter:
url: "api.com/resource/{id}"

processors:
HARCollectorResponse:
processor: HARCollector
parameters:
- key: exporter_id
value: "file_exporter_01"
- key: transaction_max_size_bytes
value: 5000
- key: obfuscate_enabled
value: true
- key: obfuscate_exclusions
value:
- '$.request.query_param.id' # Exclude specific query parameters from obfuscation
- '$.request.body.user.name' # Exclude specific paths in the request body from obfuscation
- '$.response.headers["Retry-after"]'
metrics:
enabled: true # Enables metric collection for this processor
labels:
- flow_name
- processor_key
- http_method
- url
- status_code
flow:
request:
- from:
stream:
name: globalStream
at: start
to:
stream:
name: globalStream
at: end

response:
- from:
stream:
name: globalStream
at: start
to:
processor:
name: HARCollectorResponse
- from:
processor:
name: HARCollectorResponse
to:
stream:
name: globalStream
at: end

Gateway Configuration (gateway_config.yaml)

/etc/lunar-proxy/gateway_config.yaml
exporters:
file:
exporter_id: my_file_exporter
file_dir: "/var/log/lunar-proxy"
file_name: "transaction.log"

Flow Parameters (flow.yaml)

ParameterDescriptionTypeMandatory/OptionalExample Value
nameThe name of the flow for identification purposes.StringMandatoryHARCollectorFlow
filter.urlThe URL pattern to apply the flow to specific API endpoints.StringMandatoryapi.com/resource/{id}
processors.HARCollector.processorDefines the processor used for HAR data collection.StringMandatoryHARCollector
processors.HARCollector.parameters.keyKey for specifying processor parameters.StringMandatoryexporter_id
processors.HARCollector.parameters.valueValue of the specified parameter for the processor.StringMandatoryfile_exporter_01
transaction_max_size_bytesMaximum size (in bytes) for each HTTP transaction to be logged.IntegerOptional5000
obfuscate_enabledEnables or disables obfuscation of sensitive data in the logs.BooleanOptionaltrue
obfuscate_exclusionsList of json paths of transaction components to exclude from obfuscation.ArrayOptional$.response.header["Retry-after"], $.request.query_param.id, $.request.body.user.name
metrics.enabledEnables metric collection for the processor.BooleanOptionaltrue
metrics.labelsList of labels to include in metric collection.ArrayOptional["flow_name", "processor_key", "http_method", "url", "status_code"]