GithubHelp home page GithubHelp logo

evilscientress / pygtail Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bgreenlee/pygtail

0.0 2.0 0.0 105 KB

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: GNU General Public License v2.0

Shell 0.24% Python 99.76%

pygtail's Introduction

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).
  -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.
  --read-from-end       Read log file from the end if offset file is
                        missing. Useful for large files.
  --log-pattern         Custom log rotation glob pattern. Use %s to
                        represent the original filename. You may use this
                        multiple times to provide multiple patterns.
  --full_lines          Only log when line ends in a newline `\n`
                        (default: False)
  --version             Print version and exit.

In your code:

from pygtail import Pygtail

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

Contributing

Pull requests are very much welcome, but I will not merge your changes if you don't include a test. Run tests with python setup.py test.

Build status

Build Status

pygtail's People

Contributors

akashawasthi avatar atward avatar bgreenlee avatar bibi21000 avatar btiernay avatar chrysn avatar czchen avatar darknight avatar evilscientress avatar mdunitz avatar msabramo avatar notsqrt avatar sbraz avatar woutervh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.