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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.