Coder Social home page Coder Social logo

logtailn's Introduction

logtailn.c -- multi log file tail program that remembers last position.

Usage: logtailn [-o <offset_file>] <LOG_FILE> ... <LAST_LOG_FILE>

The program will read in a standard text log files and outputs to stdout.

After reading the end and outputing the files, logtailn will create an offset marker file called <LAST_LOG_FILE>.offset in the same directory that will contain the decimal offset and inode of the file in ASCII format.

The offset marker is read the next time logtailn is run and the text file pointer is moved to the offset location. This allows logtailn to read in the next lines of data following the saved marker. This is good for marking log files for automatic log file checkers to monitor system events.

Rotated log files will be automatically accounted for by having the offset reset to zero for the new log file.

The order of the log files is important: the oldest should be the first and the newest listed as the last argument.

The optional <offset_file> parameter can be used to specify your own name for the offset file.

A typical use:

logtailn -o my.offset $(ls -tr /var/log/maillog* | egrep '/maillog([.-][0-9]+)?$')

Written by Attila Bruncsak Based upon the work of Craig H. Rowland

This program is covered by the GNU license.

logtailn's People

Contributors

bruncsak avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

nilly

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.