I have the following issue:
I have an application, which continuously produces output to stderr and stdout. The output of this application is captured in a logfile (the
You can leverage rotatelogs (docs here). This utility will decouple your script's stdout from the log file, managing the rotation in a transparent way. For example:
your_script.sh | rotatelogs /var/log/your.log 100M
will automatically rotate the output file when it reaches 100M (can be configured to rotate based on a time interval).