Skip to content

Instantly share code, notes, and snippets.

@schneefisch
Last active September 27, 2020 17:36
Show Gist options
  • Save schneefisch/c07463240d02c9df83037fbda3133f5c to your computer and use it in GitHub Desktop.
Save schneefisch/c07463240d02c9df83037fbda3133f5c to your computer and use it in GitHub Desktop.
search source IPs and occurrences from Apache access_log
# us awk to show the unique source-ips from access logs
awk '{ print $1 }' /var/log/*access*log | sort -n | uniq -c | sort -nr | head -20
# to use that on several compressed files:
gzip -dc /var/log/*access*.gz | awk '{ print $1 }' | sort -n | uniq -c | sort -nr
# to show only the most-occuring addresses:
gzip -dc /var/log/*access*.gz | awk '{ print $1 }' | sort -n | uniq -c | sort -nr | head -20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment