Skip to content

Instantly share code, notes, and snippets.

@marcolussetti
Created January 31, 2024 16:51
Show Gist options
  • Save marcolussetti/2601784e854045e0c5949e69c63d624a to your computer and use it in GitHub Desktop.
Save marcolussetti/2601784e854045e0c5949e69c63d624a to your computer and use it in GitHub Desktop.
Parse Haproxy Logs with GoAccess
#!/bin/bash
# Takes a set of haproxy logs, and parses them in GoAccess
# By Marco Lussetti
# Some caveats:
# 1. This uses GoAccess in a container
# 2. HAProxy works off frontends and backends, not the usual format GoAccess expects, so:
# 2a. Frontends are logged as "Remote User (HTTP authentication)"
# 2b. Backends are logged as "Virtual Hosts"
zcat --force haproxy.log* | docker run --rm -i -e LANG=$LANG allinurl/goaccess -a -o html --log-format='%^]%^ %h:%^ [%d:%t.%^] %e %v/%R/%^/%^/%L/%^ %s %b %^"%r"' --date-format='%d/%b/%Y' --time-format='%H:%M:%S' - > report.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment