adelton

logfile-tail

Output (cat) file from the last saved position

Synopsis

logfile-tail [ --status=status-directory | --status=status-file ] logfile
logfile-tail --help

Description

When processing log files, you want to continue reading where you left out the last time. The logfile-tail program uses the Logfile::Tail module internally to store the position last seen for the log file and retrieve it upon the subsequent invocation.

The program also handles rotated files -- if the log file was rotated since the last read, it is detected and the rest of the rotated file is read first, before proceeding to the newer rotate file or to the current log file.

The content is printed to the standard output.

Options

--status=STATUS DIRECTORY | --status=STATUS FILE

The parameter specifies either the status file which is used to store the position, or directory which will hold the status file. The file has to already exist (albeit empty) for the path to be recognized as status file, otherwise it is considered to be a status directory path.

--help

Short usage is printed.

Examples

# output data from Apache's access_log
logfile-tail /var/log/httpd/access_log

logfile-tail --status /var/run/apache/logfile-tail error_log

Author

Copyright (C) 2011 by Jan Pazdziora

License

This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.