Skip to main content
This page explains how to configure HAProxy and the OneFirewall Fluent Bit adapter to collect HTTP traffic logs, send them to OneFirewall, and enable MITRE ATT&CK pattern detection.

Overview

HAProxy is the ingress point. Fluent Bit collects and forwards the logs.
  • HAProxy emits structured access logs with the HAPROXY_LOG prefix.
  • Fluent Bit receives HAProxy syslog events over UDP.
  • The OneFirewall Fluent Bit adapter parses the records using catchall_parser.
  • OneFirewall analyzes the traffic for malicious behavior and pattern detection mapped to MITRE ATT&CK.
  • Optional: IPS reporting sends suspicious IPs to the OneFirewall cloud.

1. HAProxy Logging Configuration

In the global section of haproxy.cfg, send logs to stdout and to the Fluent Bit adapter over UDP.
The UDP destination must match the host and port exposed by the Fluent Bit adapter. In the Docker Compose example below, Fluent Bit listens on 172.17.0.1:31514 and forwards UDP traffic to container port 514.

2. HAProxy Frontend Configuration

In the HAProxy frontend, capture the request headers and define a log format the OneFirewall Fluent Bit adapter can parse.
The last two directives are required for OneFirewall pattern detection:
  • http-request set-var(txn.xff) hdr(X-Forwarded-For) stores the original client IP from the X-Forwarded-For header.
  • log-format "HAPROXY_LOG ..." writes a fixed log structure with the original IP, connection metadata, HTTP protocol, raw request, and status code.
The resulting log fields are:

3. OneFirewall Fluent Bit Adapter

Add the OneFirewall Fluent Bit adapter to your Docker Compose stack.
For OFA_API_URL, provide only the protocol, host, and optional port, for example https://app.onefirewall.com or http://localhost:8080. Do not include the API path. The adapter adds it.

4. Environment Variables

5. MITRE ATT&CK Pattern Detection Flow

With this configuration, HAProxy logs contain enough data for OneFirewall to analyze web traffic and detect suspicious patterns. From the HAPROXY_LOG records, OneFirewall evaluates suspicious paths, attack tools, anomalous source IPs, abusive request patterns, and other indicators linked to MITRE ATT&CK techniques.

6. Validation Checklist

After deployment, check that:
  • HAProxy starts successfully with the updated global and frontend configuration.
  • UDP port 31514 is bound on 172.17.0.1 by the Fluent Bit adapter.
  • HAProxy logs contain the HAPROXY_LOG prefix.
  • The Fluent Bit adapter logs show parsed records matching *_ofa_logs.
  • OneFirewall receives traffic events from the haproxy_waf agent.
  • IPS reporting is enabled only when OFA_API_URL_CLOUD and OFA_JWT_TOKEN_CLOUD are configured with valid cloud credentials.

Result

HAProxy serves traffic as before and writes structured logs. The Fluent Bit adapter forwards them to OneFirewall for MITRE ATT&CK pattern detection. IPS reporting and Elasticsearch output are enabled by the corresponding environment variables.