On Tue, 6 Apr 2010, Antti Harri wrote:
OK. How do I reliably get month and year out of the file?
awk will work for that and for massaging archived logs. That's also the
kind of task perl is best at.
Another option is to reconfigure the log file format. The regular Apache
format
LogFormat "%h %l %u %t \"%r\" %>s %b" common
can be replaced with something much, much easier to parse. For example:
LogFormat "%h\t%l\t%u\t%t\t\"%r\"\t%>s\t%b" common
Because connections or transactions take a while to complete, tidying up
will be necessary regardless of when the logs get rotated.
/Lars