Created
January 31, 2024 16:51
-
-
Save marcolussetti/2601784e854045e0c5949e69c63d624a to your computer and use it in GitHub Desktop.
Parse Haproxy Logs with GoAccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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