libnetwork: resolve: use structured logs for DNS error
I noticed that this log didn't use structured logs; [resolver] failed to query DNS server: 10.115.11.146:53, query: ;google.com.\tIN\t A" error="read udp 172.19.0.2:46361->10.115.11.146:53: i/o timeout [resolver] failed to query DNS server: 10.44.139.225:53, query: ;google.com.\tIN\t A" error="read udp 172.19.0.2:53991->10.44.139.225:53: i/o timeout But other logs did; DEBU[2024-02-20T15:48:51.026704088Z] [resolver] forwarding query client-addr="udp:172.19.0.2:39661" dns-server="udp:192.168.65.7:53" question=";google.com.\tIN\t A" DEBU[2024-02-20T15:48:51.028331088Z] [resolver] forwarding query client-addr="udp:172.19.0.2:35163" dns-server="udp:192.168.65.7:53" question=";google.com.\tIN\t AAAA" DEBU[2024-02-20T15:48:51.057329755Z] [resolver] received AAAA record "2a00:1450:400e:801::200e" for "google.com." from udp:192.168.65.7 DEBU[2024-02-20T15:48:51.057666880Z] [resolver] received A record "142.251.36.14" for "google.com." from udp:192.168.65.7 As we're already constructing a logger with these fields, we may as well use it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
9d1541526c
commit
d9e082ff54
1 changed files with 1 additions and 1 deletions
|
@ -576,7 +576,7 @@ func (r *Resolver) exchange(ctx context.Context, proto string, extDNS extDNSEntr
|
|||
UDPSize: dns.MaxMsgSize,
|
||||
}).ExchangeWithConn(query, &dns.Conn{Conn: extConn})
|
||||
if err != nil {
|
||||
r.log(ctx).WithError(err).Errorf("[resolver] failed to query DNS server: %s, query: %s", extConn.RemoteAddr().String(), query.Question[0].String())
|
||||
logger.WithError(err).Error("[resolver] failed to query external DNS server")
|
||||
span.RecordError(err)
|
||||
span.SetStatus(codes.Error, "ExchangeWithConn failed")
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue