Re: log tailing
| From: | Mihamina Rakotomandimby | Date: | Mon, 02 Jul 2012 13:23:48 +0000 |
| Subject: | Re: log tailing | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318363@lists.php.net to get a copy of this message | ||
On 06/30/2012 09:32 PM, Daniel Brown wrote:
This will tail a default number of lines. I'm looking for a way to identify the last line, and when launching the PHP script I get the added line between now and that last one. There is a "logtail" utility in the "logtool" package, but I want a full PHP equivalent. The "logtail" utility inserts a "marker" in the logfile, which I find intrusive and requiring root privilege. My guess is identifying lines with hash or storing the last line in e tmp file, or... I'm looking for the least worst solution. -- RMA.<?php $ssh_entries = explode(PHP_EOL,trim(`tail /var/log/syslog | awk {'print $1,$2,$3 "|" $5 "|" $11'}`));