Up ../

Follow — follow a file

A small program that tracks the contents of a log file by keeping the device, inode and offset of the end of the file in a state file. Mainly used from cron jobs.

Example - report on the proxy traffic since the last run

follow -o /squid/run/access.stat -f /squid/log/access.log | traffic_report

Source in files/

If the log is rotated between the last run of follow and the next run, the lines from the end of the last run to the end of that log file are lost to follow - it just starts from the beginning of the new log file.

To fix this the program would need a strategy to locate the rotated file and check that file's inode number (and assuming it wasn't compressed.)

Creative Commons CC0

James Sainsbury

MJR's retail program Although if the log file is being written faster than retail can read it I am not sure the process will exit before the log file is rotated.