/ Zope / Apsis / Pound Mailing List / Archive / 2006 / 2006-05 / HOWTO convert pound logs to apache logs for webalizer

[ << ] [ >> ]

[ flexible idea on how to offer the functionality ... ] [ Logging IP addresses in apache logs / "Tim ... ]

HOWTO convert pound logs to apache logs for webalizer
"Gevik Babakhani" <gevik(at)xs4all.nl>
2006-05-11 10:05:21 [ FULL ]
Here is a small script to convert pound logs to be used in webalizer and
apache.

By default webalizer cannot understand pound logs because of an extra
datetime and redirect domain secton in the log entries. So we parse the
pound logs line by line to a php script choping the unwanted sections and
pipe the output to a file webalizer can read.

Requirement:
PHP 5.+
pound 2.+

pound.cfg:
LogLevel 3

makelog.sh:
# extract all pound logs
fgrep pound /var/log/messages >/tmp/t.txt

#extract and convert logs for just one site
fgrep "pound: www.abc.com" /tmp/t.txt | php -F makelog.php >/tmp/abc.com.log

makelog.php:
<?
        $p = strpos($argn,"pound:",0) + 7;
        $s = substr($argn,$p,strlen($argn)-$p);
        $p = strpos($s," ",0);
        $s = trim(substr($s,$p,strlen($s)-$p));
        echo "$s\n";
?>

The result of the conversion goes to /tmp/abc.com.log in example above.
Webalizer can read this file and produce correct results.

Regards,
Gevik.

Re: [Pound Mailing List] HOWTO convert pound logs to apache logs for webalizer
=?UTF-8?B?xYF1a2FzeiAnTENGJyBKYWdpZcWCxYJv?= <lukasz.jagiello(at)zjednoczenie.com>
2006-05-11 10:52:01 [ FULL ]
Zero, kierunkowy dzien dobry Panstwu jestem Gevik Babakhani :[...]

isnt more simple type own LogFormat line ? I use such one:

#v+
LogFormat= "%time3 %other %other %virtualname %host %other %other %time1
%methodurl %code %bytesd %refererquot %uaquot"
#v-
[...]

MailBoxer