I would like to capture output from a UNIX process but limit max file size and/or rotate to a new file.
I have seen logrotate, but it does not work real-time. As I understand, it is a "clean-up" job that runs in parallel.
What is the right solution? I guess I will write a tiny script to do it, but I was hoping there was a simple way with existing text tools.
Imagine:
my_program | tee --max-bytes 100000 log/my_program_log
Would give... Always writing latest log file as: log/my_program_log
Then, as it fills... renamed to log/my_program_log000001 and start a new log/my_program_log.