Skip to main content
Version: Next

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)
ParameterDescriptionTypeMandatory/OptionalExample Value
file_exporters.idUnique identifier for the File Exporter.StringMandatoryfile_exporter_01
file_exporters.file_dirDirectory where HAR logs will be stored.StringMandatory/var/log/lunar/har_logs
file_exporters.file_nameNaming pattern for the log files.StringMandatoryhar_exporter_{timestamp}.log
file_exporters.max_file_sizeMaximum size of a single log file in bytes.IntegerOptional10485760

Flow Parameters (flow.yaml)

ParameterDescriptionTypeMandatory/OptionalExample Value
nameThe name of the flow for identification purposes.StringMandatoryHARMetricsExporterFlow
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.StringMandatoryHARMetricsCollector
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_sizeMaximum size (in bytes) for each HTTP transaction to be logged.IntegerOptional5000
obfuscate_enabledEnables or disables obfuscation of sensitive data in the logs.BooleanOptionaltrue
obfuscate_exclusions.query_paramsList of query parameters to exclude from obfuscation.ArrayOptional["id"]
obfuscate_exclusions.request_body_pathsList of paths in the request body to exclude from obfuscation.ArrayOptional["user.name"]
obfuscate_exclusions.response_headersList of response headers to exclude from obfuscation.ArrayOptional["Retry-After"]
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"]