Dec 232009
 

The most widely used command for monitoring log file is tail. Tail binary allows a user to watch the log file grow in realy time. Watching the log file grows can be done using an additional -f parameter. Alternatively, another approach to watch a log file grows can be done using tailf binary command.

Tailf:
tailf will print out the last 10 lines of a file and then wait for the file to grow. It is similar to tail -f but does not access the file when it is not grow-ing. This has the side effect of not updating the access time for the file, so a filesystem flush does not occur periodically when no log activity is happening.

tailf is extremely useful for monitoring log files on a laptop when logging is infrequent and the user desires that the hard disk spin down to conserve battery life.

Example:

tailf /var/log/squid/access.log

Similarly you can watch the same log file using -f argument

Example:

tail -f /var/log/squid/access.log

tailf is similar to

less +F /var/log/exim_mainlog

without the pause and resume features. See the less +F post here.

 Posted by at 11:21 pm

 Leave a Reply