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:
HARCollector:
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:
query_params: ["id"] # Exclude specific query parameters from obfuscation
request_body_paths: ["user.name"] # Exclude specific paths in the request body from obfuscation
response_headers: ["Retry-After"] # Exclude specific response headers from obfuscation
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: HARCollector
response:
- from:
processor:
name: HARCollector
to:
stream:
name: globalStream
at: end
Gateway Configuration (gateway_config.yaml)
The gateway configuration defines the file export settings for HAR data.
/etc/lunar-proxy/gateway_config.yaml
file_exporters:
- id: file_exporter_01
file_dir: "/var/log/lunar/har_logs" # Directory where HAR logs will be stored
file_name: "har_exporter_{timestamp}.log" # Naming pattern for log files
max_file_size: 10485760 # Maximum file size in bytes (10 MB)
Parameter | Description | Type | Mandatory/Optional | Example Value |
---|---|---|---|---|
file_exporters.id | Unique identifier for the File Exporter. | String | Mandatory | file_exporter_01 |
file_exporters.file_dir | Directory where HAR logs will be stored. | String | Mandatory | /var/log/lunar/har_logs |
file_exporters.file_name | Naming pattern for the log files. | String | Mandatory | har_exporter_{timestamp}.log |
file_exporters.max_file_size | Maximum size of a single log file in bytes. | Integer | Optional | 10485760 |
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.query_params | List of query parameters to exclude from obfuscation. | Array | Optional | ["id"] |
obfuscate_exclusions.request_body_paths | List of paths in the request body to exclude from obfuscation. | Array | Optional | ["user.name"] |
obfuscate_exclusions.response_headers | List of response headers to exclude from obfuscation. | Array | Optional | ["Retry-After"] |
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"] |