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
18.5k stars 1.11k forks source link

Cutom log format error #2187

Open howdydevops opened 3 years ago

howdydevops commented 3 years ago

Hello,

I am getting following error.

root@stag-vultr:~# goaccess -f /var/log/nginx/energy.staging90.com.access.log -a

GoAccess - version 0.8.5 - Sep 17 2021 04:01:53

Fatal error has occurred Error occured at: goaccess.c - main - 832 Nothing valid to process.

Sample log: [21/Sep/2021:18:39:46 +1000] 108.61.185.105 0.424 - energy.staging90.com "GET / HTTP/2.0" 503 3929 0.423 "https://energy.staging90.com/" "WordPress/5.8.1; https://energy.staging90.com"

Could you please advise me with the correct log format.

Thank you!

allinurl commented 3 years ago

This should work. Also, please make sure to update your goaccess to the latest version since 0.8.5 is pretty behind.

goaccess access.log --log-format='[%d:%t %^] %h %T %^ %v "%r" %s %b %^ "%R" "%u"' --date-format=%d/%b/%Y --time-format=%T

Feel free to use the official deb repo if running debian/ubuntu.

massih10 commented 3 years ago

Could you help me with my log as well?

217.230.242.0.0 - - [28/Sep/2021:00:00:03 +0200] "GET /datascience/stats HTTP/2.0" 200 436 "https://domain/datascience" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 OPR/79.0.4143.50" "-"
goaccess aggregated.log --log-format=COMBINED
Parsed 1 linesproducing the following errors:

Token '217.230.242.0.0' doesn't match specifier '%h'

Format Errors - Verify your log/date/time format

I think goaccess has problems with anonymized ip addresses, where the 2 last octetts are replaced by zeros. Any workaround?

0bi-w6n-K3nobi commented 3 years ago

Hi @massih10

Please, try the suggestion made for allinurl. It is seems OK and work in my tests. However, if You have some problem, maybe you can try set LANG, i.e. export LANG en_US.UTF-8, and try run again.