-
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
input.dns_query does not log return code on error #5276
Comments
It would also be great to see which server in the list of servers caused that error in the logs. |
I agree this would be better as a metric using the |
I would be quickly able to do the change to the log message. If you want me to do this, I anyways first have to discuss the CLA stuff with my employer which is quite a lot of overhead for a one line change... I'd be happy if someone else (who already has signed the CLA) could do the log message instead. |
No problem, I'll put it on the next release milestone for us to complete but these targets often slip. |
From what I see it's always been creating a metric with the result and result_code, but I've enhanced the logging to give more information:
|
The logging is good but I think to close this issue we need to add the rcode to the metrics. Since we can't include the dns rcode in the |
Ya that makes sense, probably what was meant above lol. I'll get that in too. |
Yeah, the logged data is already good enough to react on a generic telegraf error, but since in some cases these return codes might even be expected, the nicer solution would be to expose them as metric (per DNS server) instead of a general "DNS is healthy/not healthy" metric. |
We added this as a new tag+field pair in #5417, can you take a look? |
Looks great, thanks! |
Relevant telegraf.conf:
[[inputs.dns_query]]
domains = ["google.com"]
servers = ["1.1.1.1"]
record_type = "A"
System info:
telegraf 1.9.2
Linux amd64
Steps to reproduce:
servers
listExpected behavior:
I see the response code of the failing DNS query in the logs (ideally, it would even get exported as metric).
Actual behavior:
E! [inputs.dns_query]: Error in plugin: Invalid answer name google.com after A query for google.com
Additional info:
List of response codes in numeric format:
https://github.com/miekg/dns/blob/db3d0ce13bdc1a6b8c7f6bdf75448e9a4306951b/types.go#L119-L139
List of response codes as strings:
https://github.com/miekg/dns/blob/513c1ff2211924517b6015ebdbb995e8a10c028c/msg.go#L169-L191
Logging in telegraf happens here:
telegraf/plugins/inputs/dns_query/dns_query.go
Lines 152 to 154 in e20ba1e
The text was updated successfully, but these errors were encountered: