Skip to content

Pygtail reads log file lines that have not been read. It will even handle log files that have been rotated. Based on logcheck's logtail2 (http://logcheck.org)

License

Notifications You must be signed in to change notification settings

valenmope/pygtail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pygtail

A python "port" of logcheck's logtail2.

Pygtail reads log file lines that have not been read. It will even handle log files that have been rotated.

Usage

From the command line:

Usage: pygtail.py [options] logfile

Print log file lines that have not been read.

Options:
  -h, --help            show this help message and exit
  -o OFFSET_FILE, --offset-file=OFFSET_FILE
                        File to which offset data is written (default:
                        <logfile>.offset).
  -p, --paranoid        Update the offset file every time we read a line
                        (as opposed to only when we reach the end of the
                        file).
  --no-copytruncate     Don't support copytruncate-style log rotation.
                        Instead, if the log file shrinks, print a warning.

In your code:

from pygtail import Pygtail

for line in Pygtail("some.log"):
    sys.stdout.write(line)

Build status

Build Status

About

Pygtail reads log file lines that have not been read. It will even handle log files that have been rotated. Based on logcheck's logtail2 (http://logcheck.org)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Shell 0.4%