From a251f8ad80fec049cc5ab3e8e3c8ddf1ae9b7e2d Mon Sep 17 00:00:00 2001 From: Dan Stough Date: Mon, 8 Jul 2024 10:34:00 -0400 Subject: [PATCH] fix(dns): spam ttl logs for prepared queries (#21381) --- .changelog/21381.txt | 4 ++++ agent/discovery/query_fetcher_v1.go | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changelog/21381.txt diff --git a/.changelog/21381.txt b/.changelog/21381.txt new file mode 100644 index 0000000000..e69989f032 --- /dev/null +++ b/.changelog/21381.txt @@ -0,0 +1,4 @@ +```release-note:bug +dns: Fixes a spam log message "Failed to parse TTL for prepared query..." +that was always being logged on each prepared query evaluation. +``` \ No newline at end of file diff --git a/agent/discovery/query_fetcher_v1.go b/agent/discovery/query_fetcher_v1.go index da76d744dd..31f74c0119 100644 --- a/agent/discovery/query_fetcher_v1.go +++ b/agent/discovery/query_fetcher_v1.go @@ -363,11 +363,12 @@ func (f *V1DataFetcher) FetchPreparedQuery(ctx Context, req *QueryPayload) ([]*R if err == nil { ttlSec := uint32(ttl / time.Second) ttlOverride = &ttlSec + } else { + f.logger.Warn("Failed to parse TTL for prepared query , ignoring", + "ttl", out.DNS.TTL, + "prepared_query", req.Name, + ) } - f.logger.Warn("Failed to parse TTL for prepared query , ignoring", - "ttl", out.DNS.TTL, - "prepared_query", req.Name, - ) } // If we have no nodes, return not found!