logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Rotate access logs
Author
jose.molinab



Joined: 01 Aug 2011
Posts: 5

PostPosted: Mon 01 Aug '11 19:39    Post subject: Rotate access logs Reply with quote

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

PostPosted: Mon 01 Aug '11 20:20    Post subject: Reply with quote

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

PostPosted: Mon 01 Aug '11 20:54    Post subject: Reply with quote

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

PostPosted: Mon 01 Aug '11 20:59    Post subject: Reply with quote

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

PostPosted: Mon 01 Aug '11 21:06    Post subject: Reply with quote

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

PostPosted: Mon 01 Aug '11 21:19    Post subject: Reply with quote

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

PostPosted: Mon 01 Aug '11 21:30    Post subject: Reply with quote

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

PostPosted: Mon 01 Aug '11 23:03    Post subject: Reply with quote

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

PostPosted: Tue 02 Aug '11 15:48    Post subject: Reply with quote

then leave the line as the apache?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 02 Aug '11 16:23    Post subject: Reply with quote

use mod_log_rotate: use the first example. Use rotatelogs: use the second example. At least you should try Wink
Back to top


Reply to topic   Topic: Rotate access logs View previous topic :: View next topic
Post new topic   Forum Index -> Apache