Skip to content

Commit

Permalink
fix(inputs.dns_query): Include the canonical CNAME target (#15025)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Mar 20, 2024
1 parent 9080580 commit 86aedb4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/inputs/dns_query/dns_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,22 @@ func (d *DNSQuery) query(domain string, server string) (map[string]interface{},
// Fill out custom fields for specific record types
for _, record := range r.Answer {
switch x := record.(type) {
case *dns.A:
fields["name"] = x.Hdr.Name
case *dns.AAAA:
fields["name"] = x.Hdr.Name
case *dns.CNAME:
fields["name"] = x.Hdr.Name
case *dns.MX:
fields["name"] = x.Hdr.Name
fields["preference"] = x.Preference
case *dns.SOA:
fields["serial"] = x.Serial
fields["refresh"] = x.Refresh
fields["retry"] = x.Retry
fields["expire"] = x.Expire
fields["minttl"] = x.Minttl
fields["name"] = x.Hdr.Name
fields["refresh"] = x.Refresh
fields["retry"] = x.Retry
fields["serial"] = x.Serial
}
}

Expand Down

0 comments on commit 86aedb4

Please sign in to comment.