Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

albertopires/log_split

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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`

About

Split log files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.