You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ol...@veryhip.com on 2004/06/25 22:24:28 UTC

[users@httpd] header_in/out: DBILogger.pm query string missing?

Top of the day to ya,

I need to know the header_in/out for the query string.  I
have tried writing a little data dumper to no avail.  I
can't figure it out on modperl.com or apache.org.

I use DBILogger.pm to log requests to SQL database.  It's
my own version I mod'd, and it works fine, but I don't
know how to get the query string in there.

I wrote a little piece in the DBILogger.pm that dumps the
$r object ($r->uri is the uri, i tried $r->uri-query and
$r->uri-string and those don't work either) into a file
for each request but it doesn't help.  I can't find the
way to access the query string.  So I believe maybe it's
in the header as something.  I can access
$r->header_out{'hdr'} where hdr is the name of the header
like 'Location' would be the Location header.  I looked at
Apache::Connection synopsis as well to see if there was a
way I could grab this data, but no help there.

Anybody have a good way to do this?  I love my
DBILogger.pm, and have made lots of reporting programs and
it's integrated in alot of how I track who does what, but
I need query strings.  If I can't do this, I'm going to do
a File::Tail perl program on a regular log file and put it
in the database, which might be a better solution anyways.

Thanks,
Oliver

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] header_in/out: DBILogger.pm query string missing?

Posted by Robert Andersson <ro...@profundis.nu>.
Oliver, it seems you only sent your reply to my private address, but the
contents is directed to the list, so I "forward" it.

Regards,
Robert Andersson

----- Original Message ----- 
From: <ol...@veryhip.com>
To: "Robert Andersson" <ro...@profundis.nu>
Sent: Wednesday, June 30, 2004 6:50 PM
Subject: Re: [users@httpd] header_in/out: DBILogger.pm query string missing?


> Robert,
>
> Thanks so much.  The $r->unparsed_uri didn't work at all,
> but the $r->args did, so I just combined the $r->uri with
> "?" and $r->args if $r->args existed.  Now I don't have to
> write a program to Tail the apache_access.log file.  I'll
> make sure to look in source files in the future.
>
> If anyone is interested in the modified DBILogger.pm file,
> I'm going to post it at:
>
> http://www.oliverpeek.com/DBILogger.pm
>
> I haven't made it to check to see if the database table
> exists yet.  But I have a little perl program that's
> cron'd to run everyday and creates it before it's an
> issue.  But, this version will put requests into
> `2004-06-30` instead of `requests`.  This way your logs
> don't get too big.  And now it will give you the WHOLE url
> string instead of just the parsed_uri.  Let me know if
> anybody sees a better way of doing this and email me at
> jpeekii @ yahoo DOT com
>
> Thanks,
> Oliver
>
> Robert Andersson said:
>
> > oliver@veryhip.com wrote:
> >> I wrote a little piece in the DBILogger.pm that dumps
> >> the
> >> $r object ($r->uri is the uri, i tried $r->uri-query and
> >> $r->uri-string and those don't work either) into a file
> >> for each request but it doesn't help.  I can't find the
> >> way to access the query string.
> >
> > I don't know for sure, but I assume that this $r object is
> > reflecting the
> > internal C request_rec structure. If we look in the header
> > httpd.h, we find
> > part of its declaration:
> >
> >     /** The URI without any parsing performed */
> >     char *unparsed_uri;
> >     /** The path portion of the URI */
> >     char *uri;
> >     /** The filename on disk corresponding to this
> > response */
> >     char *filename;
> >     /* XXX: What does this mean? Please define
> > "canonicalize" -aaron */
> >     /** The true filename, we canonicalize r->filename if
> > these don't match
> > */
> >     char *canonical_filename;
> >     /** The PATH_INFO extracted from this request */
> >     char *path_info;
> >     /** The QUERY_ARGS extracted from this request */
> >     char *args;
> >
> > So, perhaps try $r->unparsed_uri or $r->args.
> >
> > Regards,
> > Robert Andersson
> >
> >
> > ---------------------------------------------------------------------
> > 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@httpd.apache.org
> >    "   from the digest:
> > users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail:
> > users-help@httpd.apache.org
> >
> >
>
>
>
>


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] header_in/out: DBILogger.pm query string missing?

Posted by Robert Andersson <ro...@profundis.nu>.
oliver@veryhip.com wrote:
> I wrote a little piece in the DBILogger.pm that dumps the
> $r object ($r->uri is the uri, i tried $r->uri-query and
> $r->uri-string and those don't work either) into a file
> for each request but it doesn't help.  I can't find the
> way to access the query string.

I don't know for sure, but I assume that this $r object is reflecting the
internal C request_rec structure. If we look in the header httpd.h, we find
part of its declaration:

    /** The URI without any parsing performed */
    char *unparsed_uri;
    /** The path portion of the URI */
    char *uri;
    /** The filename on disk corresponding to this response */
    char *filename;
    /* XXX: What does this mean? Please define "canonicalize" -aaron */
    /** The true filename, we canonicalize r->filename if these don't match
*/
    char *canonical_filename;
    /** The PATH_INFO extracted from this request */
    char *path_info;
    /** The QUERY_ARGS extracted from this request */
    char *args;

So, perhaps try $r->unparsed_uri or $r->args.

Regards,
Robert Andersson


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org