You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ebbe Hjorth <in...@ebbehjorth.dk> on 2008/11/21 13:30:16 UTC

[users@httpd] montly log rotation

Hi,

I run apache 2.2 on a FreeBSD v7.0 machine, with a lot of virtual hosts,
with each their own access and error log.

I have been looking at rotatelogs so i dont have to restart/reload apache,
but the rotatelogs only rotate logs on a time interval, or logs size
count.

I would like to rotate all the logs on ex. the last nigth in a month, so i
get to logs for each month, for each virtual host, and then delete the old
logs when they are a year old.

I need help on this quest.


Thank you in advance.

Best regards, Ebbe, Denmark


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] montly log rotation

Posted by fredk2 <fr...@gmail.com>.
Hi,

I am not sure at what version it started (1.2.18?) but you can use the pipe 
| rotatelog (http://httpd.apache.org/docs/2.2/programs/rotatelogs.html) eg.
daily rotation:

JkLogFile "|/usr/apache2/bin/rotatelogs -l /usr/myweb/logs/mod_jk_%Y%m%d.log
86400"

which does not involve any SIG... however these rotatlog processes will run
with the same user that you start apache with eg. root.

Rgds- FredK


Bill Davidson-6 wrote:
> 
> André Warnier wrote:
>> Under Linux, there is also a utility called "logrotate" (a separate 
>> program which will run from time to time under cron, and rotate a choice 
>> of logfiles, dictated by its configuration files).
>> We use it on all our Apache2 sites, works very nicely.
> 
> I've been looking into this for httpd that is in front of Tomcat via
> mod_jk.  One thing that concerns me is that in order to get httpd to start
> using the new log, you need to send a SIGHUP signal to the httpd process.
> That worries me in terms of sessions since httpd kills its child processes
> and rereads its configuration files as well as reopening log files.
> Will this affect currently active sessions?
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/montly-log-rotation-tp20620199p22212307.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] montly log rotation

Posted by Bill Davidson <bi...@gmail.com>.
André Warnier wrote:
> Under Linux, there is also a utility called "logrotate" (a separate 
> program which will run from time to time under cron, and rotate a choice 
> of logfiles, dictated by its configuration files).
> We use it on all our Apache2 sites, works very nicely.

I've been looking into this for httpd that is in front of Tomcat via
mod_jk.  One thing that concerns me is that in order to get httpd to start
using the new log, you need to send a SIGHUP signal to the httpd process.
That worries me in terms of sessions since httpd kills its child processes
and rereads its configuration files as well as reopening log files.
Will this affect currently active sessions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] montly log rotation

Posted by Ebbe Hjorth <in...@ebbehjorth.dk>.
> Tom Evans wrote:
>> On Fri, 2008-11-21 at 13:30 +0100, Ebbe Hjorth wrote:
>>> Hi,
>>>
>>> I run apache 2.2 on a FreeBSD v7.0 machine, with a lot of virtual
>>> hosts,
>>> with each their own access and error log.
>>>
>>> I have been looking at rotatelogs so i dont have to restart/reload
>>> apache,
>>> but the rotatelogs only rotate logs on a time interval, or logs size
>>> count.
>>>
>>> I would like to rotate all the logs on ex. the last nigth in a month,
>>> so i
>>> get to logs for each month, for each virtual host, and then delete the
>>> old
>>> logs when they are a year old.
>>>
>>> I need help on this quest.
>>>
>>>
>>> Thank you in advance.
>>>
>>> Best regards, Ebbe, Denmark
>>>
>>
>> We use cronolog for this. http://cronolog.org/
>>
> Under Linux, there is also a utility called "logrotate" (a separate
> program which will run from time to time under cron, and rotate a choice
> of logfiles, dictated by its configuration files).
> We use it on all our Apache2 sites, works very nicely.
>

Yeah i tried that, but the result wasnt what i am looking for, it got
really wierd.


/ Ebbe


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] montly log rotation

Posted by André Warnier <aw...@ice-sa.com>.
Tom Evans wrote:
> On Fri, 2008-11-21 at 13:30 +0100, Ebbe Hjorth wrote:
>> Hi,
>>
>> I run apache 2.2 on a FreeBSD v7.0 machine, with a lot of virtual hosts,
>> with each their own access and error log.
>>
>> I have been looking at rotatelogs so i dont have to restart/reload apache,
>> but the rotatelogs only rotate logs on a time interval, or logs size
>> count.
>>
>> I would like to rotate all the logs on ex. the last nigth in a month, so i
>> get to logs for each month, for each virtual host, and then delete the old
>> logs when they are a year old.
>>
>> I need help on this quest.
>>
>>
>> Thank you in advance.
>>
>> Best regards, Ebbe, Denmark
>>
> 
> We use cronolog for this. http://cronolog.org/
> 
Under Linux, there is also a utility called "logrotate" (a separate 
program which will run from time to time under cron, and rotate a choice 
of logfiles, dictated by its configuration files).
We use it on all our Apache2 sites, works very nicely.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] montly log rotation

Posted by Ebbe Hjorth <in...@ebbehjorth.dk>.

> On Fri, 2008-11-21 at 13:30 +0100, Ebbe Hjorth wrote:
>> Hi,
>>
>> I run apache 2.2 on a FreeBSD v7.0 machine, with a lot of virtual hosts,
>> with each their own access and error log.
>>
>> I have been looking at rotatelogs so i dont have to restart/reload
>> apache,
>> but the rotatelogs only rotate logs on a time interval, or logs size
>> count.
>>
>> I would like to rotate all the logs on ex. the last nigth in a month, so
>> i
>> get to logs for each month, for each virtual host, and then delete the
>> old
>> logs when they are a year old.
>>
>> I need help on this quest.
>>
>>
>> Thank you in advance.
>>
>> Best regards, Ebbe, Denmark
>>
>
> We use cronolog for this. http://cronolog.org/
>

Hi,

That looks good, how do you make it save logs only a year back? (12)


/ Ebbe


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] montly log rotation

Posted by Tom Evans <te...@googlemail.com>.
On Fri, 2008-11-21 at 13:30 +0100, Ebbe Hjorth wrote:
> Hi,
> 
> I run apache 2.2 on a FreeBSD v7.0 machine, with a lot of virtual hosts,
> with each their own access and error log.
> 
> I have been looking at rotatelogs so i dont have to restart/reload apache,
> but the rotatelogs only rotate logs on a time interval, or logs size
> count.
> 
> I would like to rotate all the logs on ex. the last nigth in a month, so i
> get to logs for each month, for each virtual host, and then delete the old
> logs when they are a year old.
> 
> I need help on this quest.
> 
> 
> Thank you in advance.
> 
> Best regards, Ebbe, Denmark
> 

We use cronolog for this. http://cronolog.org/

Cheers

Tom


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org