allinurl / goaccess

GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
https://goaccess.io
MIT License
17.88k stars 1.09k forks source link

NginxProxyManager Log Format #2085

Closed HenryKleinschmidt closed 3 years ago

HenryKleinschmidt commented 3 years ago

Hello, I'm having trouble setting up goaccess to parse NginxProxyManager's log format.

I keep getting errors like these: nginx: [alert] could not open error log file: open() "/var/lib/nginx/logs/error.log" failed (13: Permission denied) Parsed 1 lines producing the following errors: Token '[12/Apr/2021:13:26:06' doesn't match specifier '%h' Format Errors - Verify your log/date/time format

This is a sample of my log file. [12/Apr/2021:13:26:06 +0200] - 304 304 - GET https domain.com "/" [Client xxx.xxx.xxx.xxx] [Length 0] [Gzip -] [Sent-to 1xx.xx.xx.yy] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Firefox/87.0" "-""

[12/Apr/2021:13:53:41 +0200] - 200 200 - GET https my.domain.com "/api/v3/series" [Client xxx.xxx.xxx.xxx] [Length 35893] [Gzip -] [Sent-to xx.xx.xx.yy] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Firefox/87.0" "https://my.domain.com/"

Any help would be appreciated.

allinurl commented 3 years ago

This should do it:

goaccess log --log-format='[%d:%t %^] %^ %s %^ %^ %m %^ %v "%U" [%^ %h] [%^ %b] %^"%u" "%R"' --date-format=%d/%b/%Y --time-format=%T --http-protocol=no
HenryKleinschmidt commented 3 years ago

Thank you for your reply! But I still can't seem to get it right. I'm using the goaccess docker with a config file. I edited the options with the parameters you provided but I still get the same error.

allinurl commented 3 years ago

Please make sure you have access to read the file, from your first error, it seems the account you are using does not have full access to read the file. Here's the docker command

cat access.log | docker run --rm -i -e LANG=$LANG allinurl/goaccess -a -o html --log-format='[%d:%t %^] %^ %s %^ %^ %m %^ %v "%U" [%^ %h] [%^ %b] %^"%u" "%R"' --date-format=%d/%b/%Y --time-format=%T --http-protocol=no - > report.html
HenryKleinschmidt commented 3 years ago

Thanks. The report.html generated