0

Sometimes my Apache server get high load. I have a lot of VirtualHost, each one having its own log file.

The structure is like this /var/www/httpd-logs/virtualhost.com.access.log

What command could I use to find the website that got a high load in the past X minutes ?

I'll then analyze the corresponding website logs to find the issue.

Laurent
  • 406
  • 1
  • 4
  • 14

1 Answers1

1
for file in `ls -1 /var/www/httpd-logs/*.log` ; do
  echo "vhost $file"
  grep 2015:HOURHERE:MINUTESFIRSTDIGIT $file | wc -l
done

Slightly ghetto, but if you want a 10 minute period, say 2:50-2:59, then the grep line is grep 2015:14:5 $file | wc -l

Some Linux Nerd
  • 3,327
  • 3
  • 19
  • 22