View Full Version : webalizer with virtual hosts

<-- R O B -->
01-07-2004, 08:30 AM
Hi All

I have several virtual hosts on my account that I'm setting webalizer up for individually.
I've got the stats logging seperatly by editing the virtual host settings in the httpd.conf file.
Then I'm creating an instance of webalizer per virtualhost and editing its conf file to point to the correct log file, and output to a different folder per webalizer instance.
My question is - is this a good idea - will having multiple instances of webalizer running really screw things up, and if so is there a better way to do this?


01-08-2004, 08:02 PM
I'm posting here just so I can be assured of knowing when someone responds. Have the same challenge/question.

<-- R O B -->
01-09-2004, 01:10 AM
how many virtual hosts were you thinking of running webalizer for?
At the moment I have 19 instances of webalizer running without a problem (so far at least!)

One thing to note is that if you edit the webalizer.conf file manually, editing the settings in site manager will overwrite the manual changes made.

01-29-2004, 12:13 PM
I've been trying to get this to work for sometime now, for 4 VD's with no sucess.

I need some help getting this to work.

I'm using frontpage, so I'm not sure if this has any effect.

I've tried all the steps in the forums, none work and I'm pretty good at this stuff.

<-- R O B -->
01-29-2004, 03:29 PM
How far have you got and what problems are you having?
The steps involved are:

1) Get a program that will give you SSH access to the server (putty.exe for example)
2) Log into the server and edit the virtual hosts section of /etc/httpd/conf/httpd.conf (type vi /etc/httpd/conf/httpd.conf) to create seperate logs for each virtual host, an example of this would be (press i to insert text)

&lt;VirtualHost *>
ServerName pollen-8.co.uk
DocumentRoot /www/htdocs/pollen8
CustomLog /var/log/httpd/pollen-8.co.uk.log combined
ErrorLog /var/log.httpd/pollen-8.co.uk-error.log

save and quit the file (press esc and then wq then enter)

type restart to restart the httpd server

go to your web page and click on some links to make sure some visits will be logged

in your ssh client type cd /var/log/httpd
to change to the folder where you are storing the logs
type ls to view the files - listed you should have the file you named in your virtual host custom log line.

Log into site manager to and choose site applications, then tools, webalizer should be listed as an available site application. Click on it, agree to the terms, then enter your domain for the name of webalizer, press next until you get to the hide referer screen - here enter your domain name again. Press finish.

• Manually edit the configuration in putty
o log in to web server from putty
o type : cd /www/htdocs/cgi-bin/plugins/Webalizer/
o type “ls” to view all webalizer instances
o cd into the folder named after the url you are creating stats for
o type “vi webalizer.conf” to edit the conf file
o change the setting “LogFile” to : “LogFile /var/log/httpd/{sites name}.log (this is the setting in the virtual host CustomLog line in httpd.conf)
o change “OutputDir” to ; “OutputDir /www/htdocs/{name of site’s folder}/stats
o change “HostName whateveryourmaindomainis.com” to: “HostName {siteurl}”
o save the file by pressing the escape key then typing “:wq” and pressing enter

• Create stats folder in site’s folder
o Type; “cd /www/htdocs/{site folder name}
o Type: “mkdir stats”
• Run the stats from Site Manger
o From the “site application -> tools “ menu select the “link” link next to the stats we have just created

Once the stats are set up do NOT edit them via the Site Manager as it will revert the settings back to the default!!!!

You can then access the CORRECT stats from yourvirtulahostdomain.com/stats

hope that helps!

01-30-2004, 08:08 AM
oh man, not none of my sites work.

all I did was edit the httpd.conf file to add the logs.

then restart

<-- R O B -->
01-30-2004, 08:21 AM
first of all comment out all the CustomLog and ErrorLog lines you added (you can comment a line by inserting a # at the beginning of the line.

Save your httpd.conf file and the restart the server - it should report :

Starting httpd: ........[ ok ]

which will mean that there are no errors in the conf file.

Then go back in and uncomment out one line at a time and then save and restart. This way you will know which line in the httpd.conf file is messing up the server

When uncometting each line check for spelling errors and that the folder path you specify exisits for where you want to store the logs.
Remember that linux is case sensetive as well

Good Luck!

01-30-2004, 08:29 AM
well, I recovered by restoring my httpd.conf file

I tried it again, the only thing I did was add the custom and error log lines like you had layed out.

when I go to restart it won't do do it, it just fails on restart.

01-30-2004, 08:34 AM
Ah...just realized you had a typo, you had var/log.httpd so I just followed directions :) oh well too funny I changed it to var/log/httpd and it works fine so far.

let me keep on moving with the steps now.

<-- R O B -->
01-30-2004, 08:39 AM
:oops: geez I double checked that as well :roll:

Sorry spellow :!:

01-30-2004, 08:41 AM
OK, I got a question:

for this part here:

Log into site manager to and choose site applications, then tools, webalizer should be listed as an available site application. Click on it, agree to the terms, then enter your domain for the name of webalizer, press next until you get to the hide referer screen - here enter your domain name again. Press finish.

Is this for the primary domain on the / or the virtual domain name?

If you have Instand Messenger my AOL handle is spellow2.

01-30-2004, 09:17 AM
Your the man ROB, anything I can ever do for you please just ask.

It works like a charm.

02-06-2004, 09:21 AM

Everything was working fine, but when it turned to Feb. I no longer have stats for Feb, just January.

The logs in the stat's directory show data for feb, but when I go to the gui there is nothing for feb.


do you know how to fix that?

<-- R O B -->
02-06-2004, 10:30 AM
Hi Spellow

I can see Feburary stats for hookedup2.com - but not struperguide.
Have you checked your log files - they are ok to read with a text editor. (SSH into the folder where you are storing the stats and vi the log)
Check the dates to see if people have gone to your site this month (a bit of a long shot but worth checking)

I'd then go to the site manager's applications section and view the stats via there - clicking on the link here will actually run webalizer. - Although the report looks screwy - you can then go back to striperguide.net/stats and they should have refreshed

let me know the results and if its still not obvious what the problem is I'll think some more

I had a quick look at my stats and none of the ones I looked at had this problem - so it's probaly something we can fix :D

Good luck

02-06-2004, 10:51 AM
So after I ran the stats from the link in site manager, i was able to see stats for feb in the hookeudp2.com/stats folder. The stats that show up from the link in stat manager are 0.

that kinda sucks....I hope I don't have click on the link in the site manager everytime for it to refresh the stats folder, there has to be a way around this.

there has to be a way to get the cgi script to run when we go to the stats folder.

<-- R O B -->
02-06-2004, 12:29 PM
ah yes a combination of cron (sheduling software) and editing the log rotate file will do it -

SHH in then

editcron -e

you should have a line that looks like this

1 0 * * * /bin/logrotate /etc/logrotate.conf 2.&1 >/dev/null

if so exit cron and

vi /etc/logrotate.conf

I can't remember what the default settings were here but you need to specify that all log files should be rotated - not just the default one!

So I added /var/log/httpd/*.log to the line defining all the files to rotate -
here's my conf file:

#Comment in order not to compress your previous log files with gzip
rotate 5
mail rob@data-sphere.co.uk

/var/log/httpd/*.log /var/log/httpd/agent_log /var/log/httpd/error_log /var/log/httpd/ssl_request_log /var/log/httpd/ssl_engine_log &#123;

size = 1M
kill -HUP `cat /var/run/httpd.pid'

/var/log/maillog &#123;

All the paths are on one line - not 2 - thats just the page formatting.

Note the *.log will run the code in brackets for all logs, and that part of that code calls the web_logs.sh - which I think is the call to the webalizer instance for that log

The mail line will mail you the rotated logs. Obviosly you don't want to have my email address there!

Hope that helps[/code]

02-06-2004, 01:31 PM
but I guess it's not that bad, considering the stats are seperate now.

02-06-2004, 01:36 PM
oops didn't see your last post, I'll try that. thanks man, your a genius.

02-17-2004, 05:38 PM
how often does the cron rotate the log and can the schedule be modified?

02-17-2004, 05:40 PM

I made the modifcations to the logrotate.conf file, but the logs are still not being updated.

I still have to go into the site manager and click on the webalizer link to get the logs to update in the stat folder.

what gives.

02-17-2004, 05:41 PM
here is what my logrotate file looks like.

# sample logrotate configuration file
#errors scott@ahsolutions.us

# Comment in order not to compress your previous log files with gzip
rotate 5
mail scott@ahsolutions.us

/var/log/httpd/*.log /var/log/httpd/scottpellow/*.log /var/log/httpd/thefishbutler/*.log /var/log/httpd/striperguide/*.log
/var/log/httpd/ssl_request_log /var/log/httpd/ssl_engine_log {

kill -HUP `cat /var/run/httpd.pid`

/var/log/maillog {

include /etc/logrotate.d

11-29-2004, 07:52 AM
Hello all - I hope someone still sees this since this is an old post, thought I'd give it a shot!

I tried the method above and it worked fine until today, for no reason the stats refuse to update when i go to www.myseconddomain.com/stats
I use the link in site manager and update the entire site stats fine, however when i go to the /stats site I recieve older stats.

Any ideas?

11-29-2004, 08:24 PM

Thats because you have to utilize the link in Site Manager to update your /stats direcotory..


11-30-2004, 07:07 AM
Yes, as mentioned in my last post, I have gone through the site manager and used the link to update. Any other thoughts?