Coder Social home page Coder Social logo

btilly / pygtail Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bgreenlee/pygtail

0.0 1.0 0.0 144 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.34% Python 99.66%

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.

In your code:

from pygtail import Pygtail

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

Build status

Build Status

pygtail's People

Contributors

bgreenlee avatar chrysn avatar msabramo avatar notsqrt avatar czchen avatar woutervh avatar sbraz avatar atward avatar darknight avatar

Watchers

Ben Tilly 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.