Re: [users@httpd] Apache logs into PostgreSQL in realtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

bye,
DaTa

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux