Skip to main content

Reads log file lines that have not been read.

Project description

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).
  -n N, --every-n=N     Update the offset file every N'th 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygtail-0.6.1.tar.gz (5.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page