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

keep and count only values higher than 0 #2206

Open mihaipopoiag opened 3 years ago

mihaipopoiag commented 3 years ago

Hello,

I know it's not an issue and i know awk can help me, but it seems i miss the right syntax everytime. My log looks like this:

11.22.33.44 - - [12/Oct/2021:17:36:24 +0300] "GET /audio.ogg HTTP/1.1" 200 6690969 "-" "someapp/7.8.1 (Linux;Android 11) ExoPlayerLib/2.14.2" 824

And i only need to log the rows with the last column's value higher than 0 (this is the duration of that connection in seconds), because i get a lot of those and are just like spam in an email :)) I know $NF is the last column, but how to pipe it i missed every single time. Thank you! mihai

0bi-w6n-K3nobi commented 3 years ago

Hi @mihaipopoiag

Maybe you can try this:

awk '$NF>0' LOGFILE | goaccess ... -f-

Do You need help for --log-format and others options?

mihaipopoiag commented 3 years ago

Thank you, @0bi-w6n-K3nobi, i'll try it. Anything can help. For the moment i use in the conf file date-format %d/%b/%Y time-format %T log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %T

Anything wrong here?

Thank you!

0bi-w6n-K3nobi commented 3 years ago

Hi @mihaipopoiag

Seems ok to me. I tested and all fields/graphs is fine.

Do you have some problem with this CONF? If had, maybe you try set LANG -- i.e. export LANG=en_US.UTF-8

and run GoAccess again.

I hope that could helped You.