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

Re: can apache log to MySQL ?



On Wed, May 10, 2000 at 11:35:45AM +0200, Dariush Pietrzak wrote:
> >     is there anybody here doing that ? 
> > i.e., piping apache logs directly to MySQL ?  also, can anyone suggest
> > to me any app w/c converts
> > and puts apache logs in MySQL tables ?
> Well, debian's got it all covered:
> 
> Package: libapache-dbilogger-perl

this works fine if you're willing to use mod_perl, which is a
significant overhead if all you want is to log to an SQL database.


another way to do it is to write a small perl (or whatever) program
which reads apache log entries on stdin and injects them into a database
- should be less than 20 lines of perl using DBI.

then set up apache to pipe the logs into that program.  easy.

e.g.

	CustomLog "|/path/to/dbi-logger.pl" combined

if you have multiple virtual hosts, you probably want to define a custom
LogFormat which includes the virtual host name...or just pass that on
the pipe's argument list, but then you end up with one logger script
running for each virtual host (and one file handle for the pipe and one
dbi connection to the database etc).

<VirtualHost xxx.xxx.xxx.xxx>
    Servername somewhere.org
	.
	.
	.
	CustomLog "|/path/to/dbi-logger.pl somewhere.org" combined
</VirtualHost>

> btw, why do you choose mysql? it ain't free, it ain't any good 
> try Oracle, Sybase, PostgresSQl, 
> they are ok, and Postgres is free

agreed - postgres is MUCH better than mysql, and it's free.

craig

--
craig sanders



Reply to: