in reply to Reading only new lines from a file
It possible (and better) that the log rotation software is taking the following steps to rotate the logs;
For this example, only three old log files are being kept.
The last step will truncate the logfile to 0 bytes but doesn't cause a new file to be created so the inode number will not change. This is a better method because the process that is writing to the log file doesn't need to be restarted (or HUP'd).
Depending upon the frequency of the monitoring of the log file, just keeping track of the size of the file will allow you to know that the file has been truncated. If the file size is smaller than it was last time, you can be confident that the file has been truncated and you need to display all of it. Of course there is the risk that if the file is being written to quickly, this method won't pick up all of the changes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading only new lines from a file
by dsheroh (Monsignor) on Sep 01, 2007 at 01:32 UTC | |
by bruceb3 (Pilgrim) on Sep 01, 2007 at 01:47 UTC |