Skip to main content
This guide shows you how to capture logs from an HAProxy Docker container, extract relevant fields, and forward them to OneFirewall’s traffic validation API using Fluent Bit and Lua scripting.

Overview

  • HAProxy logs are sent directly to Fluent Bit over UDP (syslog)
  • Fluent Bit extracts fields (like source IP and HTTP status)
  • Lua script transforms log into a JSON payload
  • Fluent Bit posts the data to OneFirewall’s API

1. Folder Structure


2. HAProxy Configuration

haproxy.cfg

This configuration sends logs over UDP to Fluent Bit, which must be running in the same Docker network.

3. Fluent Bit Parser

parsers.conf


4. Lua Script for Transformation

send_to_onefirewall.lua


5. Fluent Bit Configuration

fluent-bit.conf


6. Docker Compose Example

Ensure both containers are on the same network (Docker Compose does this by default).

7. OneFirewall Traffic Validation

When Fluent Bit sends structured traffic data to OneFirewall:
  • OneFirewall validates src_ip and dst_ip fields
  • Invalid or private IPs are rejected with:
  • Ensure you’re using valid public IPv4 addresses for testing.

✅ Result

With this setup:
  • HAProxy sends logs over UDP to Fluent Bit
  • Fluent Bit parses and transforms the data with Lua
  • JSON is posted to OneFirewall’s traffic validation API

🔒 Notes

  • Replace YOUR_TOKEN_HERE with your actual OneFirewall token
  • Consider adding retry/failure handling or S3 backup for production
  • Ensure dst_ip is not a private/local IP unless OneFirewall allows it

💬 Need Help?

Feel free to reach out to OneFirewall Support if you need help debugging HTTP integration or validating traffic.