Author |
|
jose.molinab
Joined: 01 Aug 2011 Posts: 5
|
Posted: Mon 01 Aug '11 19:39 Post subject: Rotate access logs |
|
|
Hi,
I have an Apache/2.2.17 (Win32) PHP/5.3.4 installed on Windows 2008 x64.
I need to set the rotation of access logs the virtualhost every night since I have 10GB log files and can not be treated.
How do I set this in Apache for Windows?
thanks |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 01 Aug '11 20:20 Post subject: |
|
|
On apachehaus.com here is Mod Log Rotate for x64 Apache. With that module you can rotate the files by time. So files won't get that large.
You also could use rotatelogs.exe [1]
Code: |
CustomLog "|C:/apache22/bin/rotatelogs C:/log/access.log 86400" common
|
[1] http://httpd.apache.org/docs/current/programs/rotatelogs.html |
|
Back to top |
|
jose.molinab
Joined: 01 Aug 2011 Posts: 5
|
Posted: Mon 01 Aug '11 20:54 Post subject: |
|
|
Hi
the Apache/2.2.17 (Win32) is x32, serves the same module x64? the number is 86400 seconds?. Apache there is x64? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 01 Aug '11 20:59 Post subject: |
|
|
Whoops sorry I overread that your apache is 32bit. On http://www.apachelounge.com/download/ you can find a 32 bit version. Yes the 86400 are second. And yes on apachehaus you can find a complete apache in x64. |
|
Back to top |
|
jose.molinab
Joined: 01 Aug 2011 Posts: 5
|
Posted: Mon 01 Aug '11 21:06 Post subject: |
|
|
Hi,
But I copied the folder mod_log_rotate.so in Apache dir, but the rotatelogs.exe and where is it? In the download area?, whre i copied?
Then I add a line in httpd.conf or a Windows task.
If you set the log rotate at 5pm, which file I generated, 5pm to 5am or create one per day
thanks |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 01 Aug '11 21:19 Post subject: |
|
|
Use only one. Mod_logrotate or rotatelogs.exe. rotatelogs.exe
should be in the in the apache bin folder where httpd.exe is.
For mod_lorotate config see
http://hexten.net/wiki/index.php/Mod-log-rotate |
|
Back to top |
|
jose.molinab
Joined: 01 Aug 2011 Posts: 5
|
Posted: Mon 01 Aug '11 21:30 Post subject: |
|
|
IS correct??
LoadModule log_rotate_module modules/mod_log_rotate.so
RotateLogs On
RotateInterval 86400
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
OR
LoadModule log_rotate_module modules/mod_log_rotate.so
RotateLogs On
CustomLog "|D:/apache/bin/rotatelogs D:/Apache/log/access_ex%y%m%d.log combined 86400" common |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 01 Aug '11 23:03 Post subject: |
|
|
I do it like
Code: |
LoadModule log_rotate_module modules/mod_log_rotate.so
RotateLogs On
RotateInterval 86400
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog logs/%Y%m%d-%H%M%S.access.log combined
|
if you wanna use rotatelogs you DON'T have to load mod_log_rotate.
Just
Code: |
CustomLog "|D:/apache/bin/rotatelogs D:/Apache/log/access_ex%Y%m%d.log 86400" combined
|
use only one of it, not both! |
|
Back to top |
|
jose.molinab
Joined: 01 Aug 2011 Posts: 5
|
Posted: Tue 02 Aug '11 15:48 Post subject: |
|
|
then leave the line as the apache? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 02 Aug '11 16:23 Post subject: |
|
|
use mod_log_rotate: use the first example. Use rotatelogs: use the second example. At least you should try |
|
Back to top |
|