I have a pod running in kubernetes with some sidecars tailing different log files from the "master" container with following command:
tail -n+1 -f path/to/log.file
The problem is that, some days after deployed the pod, one of the sidecars stops tailing logs, while the rest of them continue to work normally.
The one that fails is always the same, tailing a bigger log file compared to the others.
I went into the sidecar and tailed manually and then I could see the logs normally.
The pod didn't restart and the log file was not recreated at the time the tailing stopped. The only think I can see is that the pod released some memory some minutes earlier, but I don't know how this could be related to the issue.
Any ideas what could cause this?
The issue was due to recreation of the log file. the issue seems to be solved after replacing -f with -F.
tail -n+1 -F path/to/log.file
Still not sure why in the other cases with log rotation there was no problem, but anyway this should not be an issue from now on