You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Brad <br...@intradonline.com> on 2007/06/16 04:17:44 UTC
Access apache log variables, eg %h in PerlLogHandler
Is there any way I can read variables from apache's log system back into
a PerlLogHandler? %h %l etc
Re: Access apache log variables, eg %h in PerlLogHandler
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Brad wrote:
> Hi, thanks for the reply Geoff. I'm actually trying to access the %O
> bytes sent that logio.c places amongst the other variables within the
> logging module. Thats something that I can't find elsewhere. Sorry
> about the %h %i example, i thought %O would over complicate the
> question :)
mod_perl generally uses $r->bytes_sent() for this kind of thing
http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_bytes_sent_
but note the caveat in the docs - it's unlikely bytes_sent() will match
mod_logio's results. it's a shame mod_logio doesn't set its result in
subprocess_env, which would make accessing it's results a simple matter.
the cool thing, though, is that mod_logio itself has an api, registering
optional functions that you can call. is, if you _really_ wanted
mod_logio's results you could use some simple xs to create a wrapper and
get at them :)
HTH
--Geoff
Re: Access apache log variables, eg %h in PerlLogHandler
Posted by Brad <br...@intradonline.com>.
Hi, thanks for the reply Geoff. I'm actually trying to access the %O
bytes sent that logio.c places amongst the other variables within the
logging module. Thats something that I can't find elsewhere. Sorry
about the %h %i example, i thought %O would over complicate the
question :)
Thanks,
Brad.
On Mon, 2007-06-18 at 12:43 -0400, Geoffrey Young wrote:
>
> Brad wrote:
> > Is there any way I can read variables from apache's log system back into
> > a PerlLogHandler? %h %l etc
>
> you might as well forget about %l - nobody runs with identd. as for %h
> you can use $r->c->get_remote_host()
>
> http://perl.apache.org/docs/2.0/api/Apache2/Connection.html#C_get_remote_host_
>
> mod_log_config merely uses the apache api to spit those bits out to the
> log file. so browse the Apache2::RequestRec, ::ServerRec, ::Conection,
> etc and you'll have whatever info you need.
>
> http://perl.apache.org/docs/2.0/api/
>
> HTH
>
> --Geoff
Re: Access apache log variables, eg %h in PerlLogHandler
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Brad wrote:
> Is there any way I can read variables from apache's log system back into
> a PerlLogHandler? %h %l etc
you might as well forget about %l - nobody runs with identd. as for %h
you can use $r->c->get_remote_host()
http://perl.apache.org/docs/2.0/api/Apache2/Connection.html#C_get_remote_host_
mod_log_config merely uses the apache api to spit those bits out to the
log file. so browse the Apache2::RequestRec, ::ServerRec, ::Conection,
etc and you'll have whatever info you need.
http://perl.apache.org/docs/2.0/api/
HTH
--Geoff