GithubHelp home page GithubHelp logo

log_split's Introduction

Log_split

Log_split reads data from stdin and writes to a log file, when this log file reaches a specified size it is split.
The idea is to have a clean way to handle output from a program that is usually sent to a log file using something like:
"exemple_program > output.log"
While this works fine, sometimes the log file may grow very fast or to a very large size and then the only way to erase or clean the log file is to restart the program.
So far I couldn't find a way to clean the log file so I wrote log_split, that way I can have a clean way to compress or delete chunks of log data and also have the option to turn on/off log writing via SIGHUP, witch can be very useful during debugging.

Example

alberto@home:~/git/log_split (master)$ ./log_split
Usage: ./log_split [-h] [-v] [-o]
    -h   Print this message and exit.
    -o   Start with log writer turned off.
    -n   Set log file name prefix.
    -s   Set max log file size. (in MB)
    -v   Display version information.

alberto@home:~/git/log_split (master)$ ./any_program 2>&1 | ./log_split -n any_program.log -s 500 &

in this example every time any_program.log reaches 500 MB it will be renamed and a new one will be created.
To turn on/off the output writing just send a signal hangup to the log_split process.

alberto@home:~/git/log_split (master)$ kill -HUP `pidof log_split`

log_split's People

Contributors

albertopires avatar

Stargazers

Raydan Gaspar avatar

Watchers

 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.