Solved

Webalizer and apache log

Posted on 2003-10-28
3
508 Views
Last Modified: 2008-03-10
My apache log is very big, and I want to do log rotate. But, I think this will affect the webalizer result, it will not be accurate.

Anyone know what is the best way to solve this? Basically I dont want the apache log to be a very big files but I also want the webalizer to be able to create accurate output.

Please help,

Thanks.
0
Comment
Question by:nova2002
  • 2
3 Comments
 
LVL 8

Expert Comment

by:heskyttberg
ID: 9640485
Hi!

Well how often do you run webalizer ?
When does webalizer run ?

I ran webalizer every hour.
I rotated logs once every week, keeping 4 weeks.

This gave us very good accuracy, I never experienced that we lost any info.
Let's say webalizer runs 0:00 at night, every hour.
The logrotate runs at the same time, but it's not only apache logs that needs rotating.
Webalizer only has to parse one hour of traffic.
It will most likely be done by the time logrotate comes to apache.

If you are really, really unlucky, you might loose 45-60 minutes of traffic between 23:0x and 24:0x.

But my experience is that I at most lost 1-3 minutes if any at all.
Thoose minutes are between 24:00-24:03

Regards
/Hasse
0
 

Author Comment

by:nova2002
ID: 9640913
I came up with this solution:

* I edited "httpd" logrotate configuration in /etc/logrotate.d to be like this :

/home/www/mydomain.com/logs/*log {
    missingok
    notifempty
    sharedscripts
    prerotate
        /usr/bin/webalizer
    endscript
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

* I set webalizer.conf to do incremental and the log file to be processed is :

   /home/www/mydomain.com/logs/apache.log

* I removed 00Webalizer from /etc/cron.daily , because webalizer will be executed by logrotate process.

My scenario is : When the logrotate process occured, it will run webalizer and then rotate the log.

Is this a good solution? Or is it wrong?

I am not an experience linux admin btw.

Please if you can verify my solution :)

Thank you
0
 
LVL 8

Accepted Solution

by:
heskyttberg earned 40 total points
ID: 9648436

That is a very good solution, you may still loose a few minutes.

But that shouldn't matter much.

I just did a webalizer each hour and logrotate each week, I didn't seem to loose any traffic at all.

Regards
/Hasse
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question