Forum Moderators: phranque

Message Too Old, No Replies

Monthly rotation of Apache access logs?

         

JAB Creations

3:21 pm on Oct 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I did some reading here...
[httpd.apache.org...]

...and did some more reading online...though I still can't figure out how to set Apache to generate monthly access logs. In fact I can't seem to find any example syntax that is time based. My current host does it almost perfectly (clips the logs by four hour time zone difference) by generating a log for each month and even more importantly does not delete the log files (important to me for statistical analysis).

In XP's Apache httpd.conf file I have the following...

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>

CustomLog "logs/access.log" combined
</IfModule>

The log format is perfect though it infinitely adds to the log file. When I tried setting Apache up on Linux the entire configuration file was empty so for now I'd just like to figure out how to gain a little control over the logs on XP please.

- John

jscjso

4:39 pm on Oct 22, 2009 (gmt 0)

10+ Year Member



I am not that good. But I can try since I do not see response to yours.

I faced the same problem to track the log content.
I could not find anything after searching forums.
I finally wrote a simple program to read the ACCESS
file in my logs directory. Anyway,the access file
is hard to read. There are too much information in it.
My program filter out the things I do not want to see.
I just click the program to run when I need it. My case
is once a week.

Caterham

5:28 pm on Oct 22, 2009 (gmt 0)

10+ Year Member



Piped logging and rotatelogs [httpd.apache.org] could be one approach.

JAB Creations

5:39 pm on Oct 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Piped logs are potentially awesome however my issue with them is MySQL's import limitations. I absolutely hate having to wait for a web host tech to "allow" me to import data over X number of megabytes. I'm perfectly happy with flat file logs, I just need help figuring out how to manage them like my existing host.

- John

Caterham

2:19 pm on Oct 23, 2009 (gmt 0)

10+ Year Member



You'd like to log to a mySQL database? In your OP th question was about logging into a file and rotating per month. That's what piped logging to the rotatelogs program does (that's not syslogging!).

JAB Creations

6:33 pm on Oct 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the absolute simplest terms I want my log directory to look like this...
2009-01.gz
2009-02.gz
2009-03.gz
2009-04.gz

- John