Open jhutar opened 3 years ago
Hi there,
In your case the log seems to have a non-standard format. The script 'assumes that the client IP is the very first column in the log. I might try to patch this and add some checks.
But in the meantime, you could use this single command to get a quick overview:
cat your_log_file.txt | awk -v FS="(client:|, server:)" '{ print $2 }' | sort | uniq -c | sort -n
I see! Maybe the issue is the log I have used is actually captured container log, so it mixes both access log and error log (or how is it called). These errors were caused by my Gunicorn miss-configuration. Feel free to reject this if it does not make sense to you.
Hi @jhutar,
Ah yes the mix of error and access logs would explain the problem. In any case I should add a check if the value is a valid IP or not, will work on this soon!
First of all, thank you for the script! :)
Describe the bug
I have noticed that sometimes I'm getting dates instead of IPs in "Top 20 IP addresses that have been accessing your site:" and "Most recent...".
To Reproduce
Just ran the script with my log.
Expected behavior
There should be only IPs there
Screenshots
Input log attached (actually just
grep '2021/05/18' ...
part of it) my.log