Sunday, November 2, 2008

strace to the rescue

Background
Client would like to see some rough site usage statistics using webalizer.

Problem
After some preliminary testing, I installed and configured the webalizer tool on the production server. However, all my attempts to run webalizer resulted in "segmentation fault". Even setting the "Quiet" and "ReallyQuiet" options to "no" did not help.

[root@host ~]# /usr/bin/webalizer -c /etc/webalizer/webalizer.conf
Segmentation fault

On the other hand running webalizer without the configuration file (-c), worked.

Solution
Installed strace and ran the following:

strace -o /var/tmp/webalizer.out /usr/bin/webalizer -c /etc/webalizer/webalizer.conf

Check out the last few lines in the strace output:

[root@host webalizer]# less /var/tmp/webalizer.out
[...]
write(1, "Webalizer V2.01-10 (Linux 2.6.9-"..., 54) = 54
open("/var/www/site.com/logs/site.com-access_log", O_RDONLY|O_LARGEFILE) = 3
write(1, "Using logfile /var/www/site.com"..., 81) = 81
chdir("/var/www/html/site") = -1 ENOENT (No such file or directory)
write(2, "Error: Can\'t change directory to"..., 61) = 61
exit_group(1) = ?


Sure enough I had a typo in the webalizer.conf file. The path I specified for the "OutputDir" option was incorrect.

VVK

No comments:

Post a Comment