Skip to content

Instantly share code, notes, and snippets.

View luisfernandomoraes's full-sized avatar
🏠
Working from home

Luís Fernando luisfernandomoraes

🏠
Working from home
View GitHub Profile
@luisfernandomoraes
luisfernandomoraes / top-20-user-agents-and-ips-from-directadmin-logs.sh
Created July 27, 2020 17:52 — forked from joostvanveen/top-20-user-agents-and-ips-from-directadmin-logs.sh
Loop though all rotated access logs and get the top 20 list of User AgentsThis can be used to identify bots
# Loop though all rotated Directadmin access logs and get the top 20 list of User Agents
# This can be used to identify bots
zcat /home/USER/domains/DOMAIN/logs/LOGNAME.tar.gz* | awk -F\" '{print $6}' | sort | uniq -c | sort -nr | head -20
# Get top 20 IP addresses
zcat /home/USER/domains/DOMAIN/logs/Feb-2019.tar.gz | awk -F\" '{print $1}' | sort | uniq -c | sort -nr | head -20
# Get top 20 most visited URLs
zcat /home/USER/domains/DOMAIN/logs/Feb-2019.tar.gz | awk -F\" '{print $4}' | sort | uniq -c | sort -nr | head -20