fix(logging): handle file rotation of splunkd_sterr.log #684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issue with logging of standard error messages where standard error logs would be lost when logging large amount of data to stadard error.
Splunk logs to splunkd_stdout.log as the Unix standard error device. This file is rotated. According to What Splunk software logs about itself, "The historical rotation for most internal logs is 5 files of 25MB each".
docker-splunk container tails the output of splunkd_stdout.log to standard output. The existing behavior is that the container receives Splunk's standard error messages until splunkd_stdout.log is about 25MB. When the log files passes 25MB, Splunk rotates the log file by rename splunkd_stdout.log to something like splunkd_stoudt1.log and creating a new splunkd_stdout.log.
By default, tail follows the file descriptor of argument file. I believe that if the file is renamed, it continutes to track the file descriptor of argument file, if that is available. This is not the behavior we want for file rotation, since we always want to follow the information that goes to splunkd_stdout.log and not splunkd_stdout1.log, splunkd_stdout2.log, etc.
Fix standard error logs not surfacing by passing
-F
option to unix tail command. This causes tail to keep retrying to open argument file name if it becomes unavailable.Change in behavior to print standard error logs to standard out for entire lifetime of the program, instead of stopping after the first file rotation.
Fix #626