Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We use webalizer to generate reports on our Apache access logs - it is useful in conjunction with Google Analytics.

The problem is that webalizer uses ALOT of CPU when running. If I run top I can see two perl processes with 90% CPU - this slows down the machine and therefore the website for our users.

Webalizer is run via a daily cron job (/etc/cron.daily/00webalizer):

#! /bin/bash
# update access statistics for the web site
if [ -s /var/log/httpd/access_log ]; then
   exec /usr/bin/webalizer -Q
fi

Does anyone know how to limit how much CPU webalizer can use? For example, would nice help and how would I use it?

share|improve this question

2 Answers 2

Yes nice would help, it lower the process priority so your webserver and thus users get priority.

exec nice /usr/bin/webalizer -Q 
share|improve this answer
    
Thanks - I'll give it a try. Will it lessen the CPU load at all? –  Tom Apr 23 '10 at 9:44
    
No, but webalizer will only get scheduled when nothing else wants the CPU time –  Chris Jones Apr 23 '10 at 11:12
    
After using nice for a few days I can report that unfortunately it isn't the silver bullet I was hoping for - webalizer is still overloading the server when it runs. –  Tom Apr 26 '10 at 10:23
up vote 0 down vote accepted

Having monitored the situation for a while I have an embarrassing confession - Webalizer was not causing the load spike on our server. It was actually caused by logwatch, a different log file analyser. Both scripts were running at the same time (via cron.daily) and I only figured out which one was causing the issue by disabling one, then the other and comparing the CPU usage.

We don't need logwatch because I have never even seen the emails it produces. So, I disabled it by deleting the symbolic link in /etc/cron.daily/:

> ls -l /etc/cron.daily/0logwatch 
lrwxrwxrwx 1 root root 39 Apr 17 03:46 /etc/cron.daily/0logwatch -> /usr/share/logwatch/scripts/logwatch.pl

Problem solved. Sorry Webalizer - didn't mean to falsely accuse you of being a CPU hog.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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