I have a kubernetes pod that is running a command of the form: sh -c 'python foo.py 2>&1 | rotatelogs -e -L log -n 3 logfile 1G'This works great. However, when the pod is deleted (e.g. kubectl delete pod foo), kube restarts the pod.
Upon restart the log and logfile are empty!!! Instead, the contents should have been retained.
I've tested with:sh -c '(cat 'foo';sleep 10000) 2>&1 | rotatelogs -e -L log -n 3 logfile 1G' &
followed by kill -HUP, kill, kill -9 etc of the process and no truncation/deletion of the newest log file occurs.
Meanwhile, tests like: echo 'foo' | rotatelogs -v -L log -n 3 logfile 3B echo 'foo' | rotatelogs -v -L log -n 3 logfile 3B echo 'foo' | rotatelogs -v -L log -n 3 logfile 3B do *not* cause the file to rotate once it's 3B+ long. ... in brief, rotatelogs (at least with -n) seems utterly broken??? A. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx