Access.log file is getting quite large...

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Access.log file is getting quite large...

Postby ozental_uk » 05. April 2005 11:00

I've been running a site for around 6 months now and it's going very well. However, my ACCESS.LOG file is getting huge. Every now and again I archive the file away and start from a 0 byte file but the file is getting to over 200 MB in a month.

I use Webalizer which I presume uses ACCESS.LOG so I don't want to just stop the log from being created but I wondered if there are any potential problems having such a big LOG file - or if it is something that I just have to manage.

Is there a max size you think I should let the ACCESS.LOG file get to before archiving it away?

Any thoughts/comments?
ozental_uk
 
Posts: 21
Joined: 30. July 2004 22:17

Postby taustin » 05. April 2005 17:17

There is a program that comes with Apache called rotatelogs that will close out log files every so often (depending on what you tell it) and start a new one. It's located in the \bin directory.

It can be a bit of a bitch to figure out, but the following works:

In http.conf, in your <VirtualHost> directive (if you're not using virtual hosts, search though http.conf for where the log format is set, using CustomLog), place the following line:

CustomLog "|bin/rotatelogs.exe logs/logname.%Y-%m-%d 86400" combined

(that should all be one line)

The "logname" part should be unique to each web site (if you have more than one). The %Y-%m-%d tells it to create a file name using the year (all four digits), the month and the day. The 86400 at the end is how many seconds it should run before rotating to a new log. Combined is the log format.

http://httpd.apache.org/docs-2.0/progra ... elogs.html has more information on rotatelogs, including the % stuff to set log names. If you want to rotate weekly, set the 86400 to seven times that.
taustin
 
Posts: 150
Joined: 24. September 2004 00:23
Location: Huntington Beach CA

Postby ozental_uk » 07. April 2005 09:09

I've had a good look at this and it seems to make good sence but I just can't get it to work.

Here's the httpd.conf file content I have:

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#

#CustomLog logs/access.log common
CustomLog "|bin/rotatelogs.exe -logs/access.log 300M" common


You can see the CustomLog entry that I did have, which I commented out and replaced with the lower entry.

However, when I start apache using apache_start.bat, I just get the DOS window stating ...

Diese Eingabeforderung nicht waehrend des Running beenden
Bitte erst bei einem gewollten Shutdown schliessen
Please close this command only for Shutdown
Apache 2 is starting ...


...which then closes. Obviously, if I comment out my entry and uncomment out the original one, Apache starts OK.

I've tried all sorts of combinations of comment, including using the TIME and MB options of ROTATELOGS.EXE, adding /APACHE/BIN/ to my path statement, using COMMON and COMBINED optionos, etc. but no luck. And yes, I can execute ROTATELOGS.EXE manually so the .EXE file is there.

Any ideas?
ozental_uk
 
Posts: 21
Joined: 30. July 2004 22:17

Postby taustin » 07. April 2005 16:31

In comparing your CustomLog line and mine, I see you have a dash in front of "logs\". No idea what that would do, but it works for me without it. Other than that, I have no experience with the M option, to rotate based on file size.

My suggestion would be to start with the exact line I've got, which I know works. If you have trouble with that, then there's something wrong somewhere else. If it works, then it's a matter of experimenting with options to get it the way you want.
taustin
 
Posts: 150
Joined: 24. September 2004 00:23
Location: Huntington Beach CA

Postby ozental_uk » 08. April 2005 15:15

Oh yeah, the dash was obviously a typo. I did try it without and alas, nothing still. I'll try some different variations though.

One thing I am confused on with the direction of my slashes ( / or \ ). I've seen some web sites that have the slashes going this way... / ... and others with ...\.

For a Windows based Apache, which is right and which is wrong or do all of the following work?

Code: Select all
CustomLog "|bin/rotatelogs.exe logs/logname.%Y-%m-%d 86400" combined

CustomLog "|bin/rotatelogs.exe logs\logname.%Y-%m-%d 86400" combined

CustomLog "|bin\rotatelogs.exe logs\logname.%Y-%m-%d 86400" combined

CustomLog "|bin\rotatelogs.exe logs/logname.%Y-%m-%d 86400" combined


Also, what are the rules with the 'bin' and the 'logs' directory paths - should one have a full path statement in there or are all these paths relative to where rototelogs.exe exists? For example, could I use:

Code: Select all
CustomLog "|c:\apache\bin\rotatelogs.exe c:\apache\logs\logname.%Y-%m-%d 86400" combined
ozental_uk
 
Posts: 21
Joined: 30. July 2004 22:17

Postby taustin » 08. April 2005 16:23

ozental_uk wrote:One thing I am confused on with the direction of my slashes ( / or \ ). I've seen some web sites that have the slashes going this way... / ... and others with ...\.

For a Windows based Apache, which is right and which is wrong or do all of the following work?


I'm not sure. Apache was originally written for *nix, which uses "/" for directory stuff. Windows uses "". And, unfortunately, if I understand it correctly, Apache for Windows and PHP use different conventions. I use the *nix one - "/" - in http.conf, and it works.

ozental_uk wrote:
Also, what are the rules with the 'bin' and the 'logs' directory paths - should one have a full path statement in there or are all these paths relative to where rototelogs.exe exists? For example, could I use:

Code: Select all
CustomLog "|c:\apache\bin\rotatelogs.exe c:\apache\logs\logname.%Y-%m-%d 86400" combined


I think you can use either, but I got it to work with the relative path first, so that's what I use.
taustin
 
Posts: 150
Joined: 24. September 2004 00:23
Location: Huntington Beach CA


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 107 guests