Re: Parsing access_log entries
| From: | Joe Stump | Date: | Thu, 07 Dec 2000 22:45:01 +0000 |
| Subject: | Re: Parsing access_log entries | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29232@lists.php.net to get a copy of this message | ||
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