-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins/filestat: Create option to disable logging of missing files #6940
Conversation
Create configuration option NoLogFileMissing to prevent log spam when the file is missing. For example, when using telegraf to check for /var/run/reboot-needed (which is only present when the reboot is needed) the agent will log the following each time the file is checked, and missing: 2020-01-25T15:23:20Z E! [inputs.filestat] Unable to get info for file "/var/run/reboot-required", possible permissions issue This will allow us to disable this log alert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two comments.
- The option you added is CamelCase while options usually are in snake_case. Please also change to snake_case.
- IMO you should output the information once to prevent unexpected behavior when specifying the option, the file is there but there is indeed a permission issue.
Speaking of this, maybe you could make this the new behavior without any option. If there is a problem stat-ing the file, output the error once and set a flag. Then do not output as long as the flag is set. Once you successfully accessed the file, unset the flag and next time you fail output once again a.s.o...
@nroach44 any news? Are you still willing to carry on with this PR? |
@srebhan I can adjust the option casing but I don't have the go experience to perform the "output only once" change |
@nroach44 would appreciate the casing-changes. If you like we can work on the "output only once" together!? |
@nroach44 any chance you can adopt my suggestion? We can work this out together if you like!? |
@nroach44 any news on this one? Could you please at least fix the CamelCase issue!? |
Should we close this PR since we have this ready to be merged? #7316 |
I say yes on closing this. The PR you referenced does the same, is reviewed and doesn't add a config option. |
Create configuration option NoLogFileMissing to prevent log spam when
the file is missing. For example, when using telegraf to check for
/var/run/reboot-needed (which is only present when the reboot is needed)
the agent will log the following each time the file is checked, and missing:
2020-01-25T15:23:20Z E! [inputs.filestat] Unable to get info for file "/var/run/reboot-required", possible permissions issue
This will allow us to disable this log alert.
Required for all PRs: