Re: log tailing

From: Date: Mon, 02 Jul 2012 16:05:54 +0000
Subject: Re: log tailing
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-318366@lists.php.net to get a copy of this message
On Mon, Jul 2, 2012 at 3:23 PM, Mihamina Rakotomandimby <mihamina@rktmb.org> wrote: > On 06/30/2012 09:32 PM, Daniel Brown wrote: >>> >>> <?php >>> $ssh_entries = explode(PHP_EOL,trim(`tail /var/log/syslog | awk >>> {'print $1,$2,$3 "|" $5 "|" $11'}`)); > > > 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. You could also remember the number of bytes read, store that (in a tmp file or database), and use fseek() to skip to that exact position. - Matijn

« previous php.general (#318366) next »