Re: log tailing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 2, 2012 at 3:23 PM, Mihamina Rakotomandimby
<mihamina@xxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux