Skip to content

Instantly share code, notes, and snippets.

View schneefisch's full-sized avatar

Florian schneefisch

View GitHub Profile
@schneefisch
schneefisch / grep_snippets.sh
Last active September 27, 2020 17:36
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