Forum Moderators: phranque
I have been doing this for the past couple of months, with log files > 100 mb at the end of each month.
I downloaded the first log file to my desktop (athlon-64, 1 gb ram) and it took notepad well over 5 minutes to open it.
I'd like to know a couple of things:
Is there any sofware (preferably free / open source) that can manage log files for viewing?
ie: break down the data into something more colorful and easy on the eyes.
How can the size of the log files automaticaly be limited / divided? (i assume this can be done automaticaly)
Another alternative is to set your access log to a pipe, and pipe the incoming loglines to a script of some kind; see [httpd.apache.org ] for syntax and [cronolog.org ] for an example of such a script. I've not benchmarked this to see what kind of performance hit (if any) one takes by doing this.
As far as opening the logfile, going through it line-by-line isn't really the best way to examine your logfiles, unless you're looking for something very specific. Analysis tools exist; I'm rather partial to webalizer ([mrunix.net ]), although it does have it's limitations. It is, however, *fast*.
Does that help?
Here's my access log line, set to start a new logfile every day at midnight:
CustomLog "¦bin/rotatelogs.exe logs/access_%Y%m%d.log 86400 60" combined env=!dontlog
Our log files for one week are over 1 gB! Anyway, we use Analog for the analysis, and break the one large log file down into several sub-parts using an in-house perl program, listed here for you:
#!/usr/bin/perl
$n = 1;
$x = 1;
$source = "access_log";
$t = "access_log";
$target = $t . "." . $x;
open(TARGET,">$target");
open(FILE,$source);
while(<FILE>)
{
print TARGET "$_";
$n++;
if ($n == 500000)
{
close(TARGET);
$x++;
$n = 1;
$target = $t . "." . $x;
open(TARGET,">$target");
}
}
By amending the value $n == 500000 you can make each sub-part larger or smaller. The resulting files are named
access_log.1 access_log.2 &c.
Matt
CustomLog "¦bin/rotatelogs.exe logs/access_%Y%m%d.log 2592000 60" combined env=!dontlog
at the top of my httpd.conf should start a monthly log right?
well, I'm going to try it.
one other question, what is the 60?
this is a great community, thanks to everybody. I'm definately glad to be a part of this.
error.log had this line:
[Thu Mar 03 15:34:37 2005] [error] (2)No such file or directory: could not open transfer log file c:/program files/apache group/apache/\xa6bin/rotatelogs.exe logs/access_%y%m%d.log 86400 60.
¦ = \xa6 (?)
[edited by: bbkid at 8:51 pm (utc) on Mar. 3, 2005]