total hits per access log today with a list of 10 of the top ip’s
LOGS=$(lsof -ln | awk '$4 ~ /[0-9]w/ && $5 ~ /REG/ {FILE[$NF]++}END{for (i in FILE) print i}')
for log in $(echo "$LOGS" | grep access); do HIT_COUNT=$(grep $(date "+%d/%b/%Y") $log -c); if [[ "$HIT_COUNT" -ge 100 ]]; then echo -e "\n$log - $HIT_COUNT total hits today\n"; grep $(date "+%d/%b/%Y") $log | awk '{ if ( $2 !~ /^[0-9]/ ) REQ[$1" "$6" "$7]++; if ( $2 ~ /^[0-9]/ ) REQ[$1" "$2" "$7" "$8]++}END{for (i in REQ) print REQ[i],i}' | sort -n | tail -10 ; fi; done
total hits from bots
C=`date +%d`; D=`date +%b`; grep $C.$D /var/log/httpd/*access*log | awk '{ print $14 }' | egrep -i "googlebot|yahoo|slurp|bing|yandex|baidu|radar|easou|mj12|semrush|ccbot|ahrefsbot|megaindex|spbot|dotbot|pcore|blexbot|owlin|spinn3r|rogerbot|yoozbot" | cut -d/ -f1 | sort | uniq -c | sort -nr