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: HARMetricsExporterFlow
filter:
url: "api.com/resource/{id}"
processors:
HARCollectorRequest:
processor: HARMetricsCollector
parameters:
- key: exporter_id
value: "file_exporter_01"
- key: transaction_max_size
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
HARCollectorResponse:
processor: HARMetricsCollector
parameters:
- key: exporter_id
value: file_exporter_01 # ID of the File Exporter defined in gateway_config.yaml
- key: transaction_max_size
value: 5000 # Maximum size limit for each HTTP transaction log (in bytes)
- key: obfuscate_enabled
value: true # Enables obfuscation of sensitive data in the logs
- key: obfuscate_exclusions
value:
- $.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:
processor:
name: HARCollectorRequest
- from:
processor:
name: HARCollectorRequest
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
Flow Parameters (flow.yaml
)
Parameter | Description | Type | Mandatory/Optional | Example Value |
---|---|---|---|---|
name | The name of the flow for identification purposes. | String | Mandatory | HARMetricsExporterFlow |
filter.url | The URL pattern to apply the flow to specific API endpoints. | String | Mandatory | api.com/resource/{id} |
processors.HARCollector.processor | Defines the processor used for HAR data collection. | String | Mandatory | HARMetricsCollector |
processors.HARCollector.parameters.key | Key for specifying processor parameters. | String | Mandatory | exporter_id |
processors.HARCollector.parameters.value | Value of the specified parameter for the processor. | String | Mandatory | file_exporter_01 |
transaction_max_size | Maximum size (in bytes) for each HTTP transaction to be logged. | Integer | Optional | 5000 |
obfuscate_enabled | Enables or disables obfuscation of sensitive data in the logs. | Boolean | Optional | true |
obfuscate_exclusions | List of json paths of transaction components to exclude from obfuscation. | Array | Optional | $.response.header["Retry-after"] , $.request.query_param.id , $.request.body.user.name |
metrics.enabled | Enables metric collection for the processor. | Boolean | Optional | true |
metrics.labels | List of labels to include in metric collection. | Array | Optional | ["flow_name", "processor_key", "http_method", "url", "status_code"] |