LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 02-13-2004, 02:03 PM   #1
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Rep: Reputation: 15
Setting up webalizer for virtual host


Hi I have webalizer installed on my server and this server has 2 virtualhost (called A&B). I have setup access_logA & access_logB for each of them. Now, how do I use webalizer to monitor these 2 vHost? . How many files do I need to edit to make it work? I want after everything is setup, I can type http://www.SiteA/webalizer/ & http://www.SiteB/webalizer/ to monitor each site seperately.

Thanks
 
Old 02-13-2004, 02:13 PM   #2
jazernorth
Member
 
Registered: Jan 2004
Location: Green Bay
Distribution: RedHat 8.0, LFS-5.0
Posts: 100

Rep: Reputation: 15
edit '/etc/cron.daily/webalizer':

Code:
if [ -s /var/log/access_logA ] ; then
    /usr/bin/webalizer -c /var/webalizer/domainA.conf
fi

if [ -s /var/logs/access_logB ] ; then
    /usr/bin/webalizer -c /var/webalizer/domainB.conf
fi
Create two files (one for each domain) from original webalizer.conf file, and save as above conf files.

Basically, you are executing webalizer for each domain, with their individual settings.

Enjoy.

JN
 
Old 02-13-2004, 03:28 PM   #3
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
So do you mean just copy file webalizer.conf 2 times with different name(for 2 vHosts) and edit line:
LogFile /path/to/file/logs/access_logA (for SiteA)
and
LogFile /path/to/file/logs/access_logB (for SiteB)
(and few more lines )
and edit the cron like you said?

Thanks
 
Old 02-13-2004, 03:43 PM   #4
jazernorth
Member
 
Registered: Jan 2004
Location: Green Bay
Distribution: RedHat 8.0, LFS-5.0
Posts: 100

Rep: Reputation: 15
Here are parts two of the webalizer files I am currently using:

Example A (webalizer_domaina.conf):
Code:
LogFile        /var/log/access_logA

OutputDir      /var/www/html/domainA/webalizer/

HistoryName /var/www/html/domainA/webalizer/webalizer.hist

Incremental     yes

IncrementalName /var/www/html/domainA/webalizer/webalizer.current

ReportTitle    Usage Statistics for

HostName       DomainA.Net
.... rest of file ....
Example B (named webalizer_domainb.conf):
Code:
LogFile        /var/log/access_logB

OutputDir      /var/www/html/domainB/webalizer/

HistoryName /var/www/html/domainB/webalizer/webalizer.hist

Incremental     yes

IncrementalName /var/www/html/domainB/webalizer/webalizer.current

ReportTitle    Usage Statistics for

HostName       DomainB.Net
.... rest of file ....
Then I added the following lines to cron.daily/webalizer:
[code]if [ -s /var/log/access_logA ] ; then
/usr/bin/webalizer -c /var/www/html/donmaina/webalizer/webalizer_domainb.conf
fi

if [ -s /var/logs/access_logB ] ; then
/usr/bin/webalizer -c /var/www/html/donmainb/webalizer/webalizer_domainb.conf
fi
 
Old 02-13-2004, 04:47 PM   #5
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
Thanks a lot. I'll try when I get home.
 
Old 02-15-2004, 03:59 PM   #6
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
It works but I have another question:
How do I CLEAR log file(access_log) after running this cron job? I mean delete all record to set log file to 0KB

Thanks
 
Old 02-16-2004, 10:14 AM   #7
jazernorth
Member
 
Registered: Jan 2004
Location: Green Bay
Distribution: RedHat 8.0, LFS-5.0
Posts: 100

Rep: Reputation: 15
You can do it in the /etc/cron.daily/webalizer file. Why would you want to delete your logs? You can modify the logrotate conf file (see 'man logrotate') to rotate your access logs. This way they will stay manageable.

Enjoy.

JN
 
Old 02-16-2004, 10:42 AM   #8
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
I mean the log file will get bigger everday. So to keep the room for the hard drive, I want to clean it after webalizer take the record. For example, today, the log file is 1MB and it will be 2 MB by tomorrow. If I can take the record and clear the log file it will be only 1 MB by tomorrow. Not sure if I understand it right. Did I miss something?
For about rotaring log file, does it mean after get reading, rename that file with a new name (ie. access_log.1) and create new file(ie. access_log) with 0 record?
 
Old 02-16-2004, 11:08 AM   #9
jazernorth
Member
 
Registered: Jan 2004
Location: Green Bay
Distribution: RedHat 8.0, LFS-5.0
Posts: 100

Rep: Reputation: 15
Yup.

Logrotate will evaluate the current log file. If it is over a certain size, or certian unmodified age, it rotates it. *.4 gets deleted, *.3 becomes *.4 .... until current log becomes *.1 and is deleted to 0 records. This way, you will always have history (more than 1 day) and your log files will not get too far out of hand.

I keep mine to 4 logs and 150 days. Yes, they do get big, but I am better able to monitor when I have problems. The webalizer is used for stat purposes, but the log files are used for trouble shooting purposes.

JN
 
Old 02-16-2004, 11:24 AM   #10
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
Thanks, it makes sence now. Before, I see the access_log changed to access_log.1 and the new file is created with 0KB but I don't realy know how it works.
So for the Logrotate which file should I need to edit/config? and will it effect to the webalizer? For example, if I setup cron job to run webalizer at midnight, how am I going to setup Logrotate (or what ever) to NOT missing any report of webalizer?
 
Old 02-16-2004, 11:35 AM   #11
jazernorth
Member
 
Registered: Jan 2004
Location: Green Bay
Distribution: RedHat 8.0, LFS-5.0
Posts: 100

Rep: Reputation: 15
I changed /etc/logrotate.d/httpd to:
Code:
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}
That will evaluate every log file in httpd. As for capturing data with webalizer before logrotate moves the log files, you will need to make sure webalizer runs first. I changed my webalizer name in /etc/cron.daily to 00webalizer. This forced it to run first.

Enjoy.

JN
 
Old 02-16-2004, 03:17 PM   #12
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
1. I checked the webalizer file in cron.daily and YES, I see it named 00webalizer.conf
2. For the apache, If I have 2(or more) log files which are stored on different location, shall I change the /etc/logrotate.d/httpd to something like:
Code:
/path/to/log/FILE1 {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

/path/to/log/FILE2 {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}
..and so on?

Thanks
 
Old 02-16-2004, 03:21 PM   #13
jazernorth
Member
 
Registered: Jan 2004
Location: Green Bay
Distribution: RedHat 8.0, LFS-5.0
Posts: 100

Rep: Reputation: 15
You could. That would create lots of headaches for any additional virtual servers. I currently host 5 websites, each with their own virtual server. I have placed the * so that I don't have to modify the logrotate file each time. I just add a new log file and the logrotate takes care of the rest for me.

Where the * is, the logrotate program will rotate each condition that matches it.

Hope that helps.

Enjoy.

JN
 
Old 02-16-2004, 04:50 PM   #14
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
Thanks a lot.
 
Old 02-19-2004, 01:04 PM   #15
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Original Poster
Rep: Reputation: 15
Just 1 last question(I hope ); if my httpd logs files store at /path/to/mylogs/ and in this folder has both http & ftp log files, when I run command /path/to/mylogs/*log will it procsess both ftp & http log files or just http log files?

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
webalizer setup for virtual hosts intranet_man Linux - Security 1 03-03-2005 01:00 PM
Setting up a virtual host zupidupi Linux - Networking 2 01-30-2005 09:58 AM
Webalizer on virtual hosts? lucastic Linux - Networking 22 09-18-2004 05:43 PM
Configuring Webalizer for virtual sites. dmedici Fedora 0 07-22-2004 04:04 PM
Virtual Host |Drakehash| Linux - Networking 0 07-17-2003 04:02 PM


All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration