0

I have a long running process and I expect the log files to run into multiple hundreds of GBs. The program is a pre-compiled binary - so I can't modify the logic in the code.

Is there a command like tool (like tee) to which I can redirect my output. This tool would then write the stdout of my long running process to disk and start writing a new file as soon as I hit a certain limit (say, 1GB).

Here's what I have in mind:

%> long-running.sh | responsible-logger --max-length 1G output%02d.log

1 Answer 1

1

logrotate is the big shot of unix to split arbitrary amount of logs to chunks of given properties. A smaller but more standard tool is split which has a shorter learning curve: http://linux.die.net/man/1/split

1
  • I did not realize you can use split with piped input too - I think I'll stick to that! Mar 22, 2016 at 22:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .