splunk / docker-splunk

Splunk Docker GitHub Repository
462 stars 253 forks source link

Tailing to stdout does not follow rotated/renamed files #626

Open Chancepants opened 11 months ago

Chancepants commented 11 months ago

The tail command used to emit splunkd_stderr.log (or a custom log file) to stdout does not handle the file being rotated/renamed. The current command uses -f https://github.com/splunk/docker-splunk/blob/9.1.1/splunk/common-files/entrypoint.sh#L65 but likely should use -F

     -F      The -F option implies the -f option, but tail will also check to see if the file being
             followed has been renamed or rotated.  The file is closed and reopened when tail
             detects that the filename being read from has a new inode number.

In my current environment I have splunk running container image 9.0.6 and have verified the tail command is running via ps aux | grep tail and logs are actively being written to splunkd_stderr.log. I've also confirmed logs stopped being written to stdout immediately after file rotation splunkd_stderr.log -> splunkd_stderr.log.1.

zarend commented 1 week ago

Hello, I believe the expected behavior is docker-splunk surfaces splunkd_stderr.log to containers stdout. And that docker-splunk should tolerates file rotation.

Please let me know if you have any questions. -Zach