-
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
feat(plugins): Allow to override log-level per plugin #15677
Conversation
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.
This does not appear to work as I thought it would. For example, with this config I would expect to see debug messages from sarama:
[agent]
debug = false
omit_hostname = true
[[inputs.kafka_consumer]]
log_level = "debug"
brokers = ["localhost:9092"]
topics = ["telegraf"]
It is not until I set the agent level debug to true do those messages appear.
Another example, where I would expect to see only info messages, but I see debug message about what server is in use for the test:
[agent]
omit_hostname = true
debug = true
[[inputs.internet_speed]]
log_level = "info"
interval = "1m"
[[outputs.file]]
@powersj thanks for the thorough testing! It seems like during |
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
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.
Much better!
We may need to do a follow up with the sarama logging for example. It looks to only respect the agent level debug value and I think that is how the logic is set up right now, but this gets us plugin specific log levels!
Summary
This PR allows to override the Telegraf-wide log-level on a per plugin basis allowing to e.g. debug a certain plugin without being spammed by debug messages of other plugins.
Checklist
Related issues
resolves #6584