Hello,
I'm trying to create a listening script that monitors a logfile, and processes the
new lines written to it. I have successfully been able to with popen().
However, in case of a crash of my script, I cannot have the same logfile re-process
the same data, so I want to use ftell() and fseek() to track byte offset.
The problem is when I use fseek() i get this error:
Warning: fseek(): stream does not support seeking in /root/rlog/livelog on line 23
Is there another solution I can use to perform this. The logfile has extremely high traffic and rolls over once an hour.
$handle = popen($logfile, 'r');
while(!feof($handle)) {
fseek($handle, $offs);
$buffer = fgets($handle);
ob_flush();
flush();
//Determine last byte read
$offs = ftell($handle);
}