Re: Parsing access_log entries
| From: | John Biesnecker | Date: | Thu, 07 Dec 2000 22:54:15 +0000 |
| Subject: | Re: Parsing access_log entries | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29234@lists.php.net to get a copy of this message | ||
The problem with that method is that there are spaces within each line that
aren't field deliminators. That's why I was thinking regular expressions...
Thanks, though.
/s/ John
----- Original Message -----
From: "Joe Stump" <joe@earth.care2.com>
To: "John Biesnecker" <amraam@ao.net>
Cc: <php-general@lists.php.net>
Sent: Thursday, December 07, 2000 5:45 PM
Subject: Re: [PHP] Parsing access_log entries
> Real time eh? Well I would recommend this:
>
> <?
>
> $fp = fopen('/dev/stdin','r');
> while(!feof($fp))
> {
> $line = trim(fgets($fp,4096));
> $array_of_line = explode(' ',$line);
> // parse based on that.
> }
>
> ?>
>
> Or in your main include file (we all have one!) put a function in the logs
the
> info you want to a DB.
>
> --Joe
>
>
> On Thu, Dec 07, 2000 at 05:41:31PM -0500, John Biesnecker wrote:
> > Hello all....
> >
> > I'm trying to parse my Apache access_log files in real time. I'm
looking
> > for a function or something to split a line in the access_log into an
array
> > that i could then parse. I was thinking a regular expression would do
the
> > trick, but my skills in that area are poor to none.
> >
> > Thanks for the help.
> >
> > /s/ John
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> ---
> Joe Stump
> PHP Programmer
> www.Care2.com
>