On 1/11/09 8:44 AM, John Summerfield wrote:

Probably. How do you know how many blocks to skip?

I don't -- I calculate approximate bytes not-sparse from end-of-file
using stat -- see below. Coincidentally, it happens to be the number of
bytes in all and only the blocks at the end of the file that contain
non-sparse data. Or, to put it another way, I don't calculate how many
blocks to skip from the beginning of the file, I calculate how many
blocks to read from the end of the file.



...

It is easy? I'm missing something.


Again, this is only for log files -- only appended to, for when they get
sparse because of logrotate copytruncate or "> filename" or similar
truncation, sparse-ness at the beginning of the file.



See my post Tue, 6 Jan 2009 14:30:24 -0800 for a full example, but
here's the main part:

tail -c $(( $(stat -c %b\*%B daemon.log) )) daemon.log ...

Pretty easy, eh? Again, again, this only works for log files, although I
should have said for sparse or not-sparse log files, and if sparse,
where sparse-ness is at the beginning.

- Larry

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to