httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danijel Tasov <>
Subject Re: [users@httpd] Apache logs into PostgreSQL in realtime
Date Wed, 18 Jan 2006 10:26:41 GMT
Michelle Konzack wrote:
> What I need is a program/script which can put the log
> directly into the PostgreSQL for Real-Time analysis.

I'm using perls Text::ParseWords for doing this:

If you have the classic combined LogFormat:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

You can do:

use Text::ParseWords;
use DBI;
# Database connect here

while(<>) {
  my ($remote_host, $logname, $authuser, $time, $request,
  $status, $size, $referer, $user_agent) = quotewords(/\s+/, 0, $_)
  $dbh->do("INSERT ..."); 

$time can be easily converted by using HTTP::Date.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message