diff --git a/dnscrypt-proxy/config.go b/dnscrypt-proxy/config.go index d7c7259b..1703a4a8 100644 --- a/dnscrypt-proxy/config.go +++ b/dnscrypt-proxy/config.go @@ -76,9 +76,9 @@ type SourceConfig struct { } type QueryLogConfig struct { - File string - Format string - LoggedQtypes []string `toml:"logged_qtypes"` + File string + Format string + IgnoredQtypes []string `toml:"ignored_qtypes"` } type BlockNameConfig struct { @@ -139,7 +139,7 @@ func ConfigLoad(proxy *Proxy, svcFlag *string, config_file string) error { } proxy.queryLogFile = config.QueryLog.File proxy.queryLogFormat = config.QueryLog.Format - proxy.queryLogLoggedQtypes = config.QueryLog.LoggedQtypes + proxy.queryLogIgnoredQtypes = config.QueryLog.IgnoredQtypes if len(config.BlockName.Format) == 0 { config.BlockName.Format = "tsv" diff --git a/dnscrypt-proxy/dnscrypt-proxy.toml b/dnscrypt-proxy/dnscrypt-proxy.toml index 4ad06d68..c50ea200 100644 --- a/dnscrypt-proxy/dnscrypt-proxy.toml +++ b/dnscrypt-proxy/dnscrypt-proxy.toml @@ -150,9 +150,9 @@ cache_neg_ttl = 60 format = 'tsv' -## Only log these query types, to reduce verbosity. Keep empty to log everything. +## Do not log these query types, to reduce verbosity. Keep empty to log everything. -# logged_qtypes = ['A', 'MX'] +# ignored_qtypes = ['DNSKEY', 'NS'] ###################################################### diff --git a/dnscrypt-proxy/main.go b/dnscrypt-proxy/main.go index 9425becc..ca2532c2 100644 --- a/dnscrypt-proxy/main.go +++ b/dnscrypt-proxy/main.go @@ -38,7 +38,7 @@ type Proxy struct { cacheMaxTTL uint32 queryLogFile string queryLogFormat string - queryLogLoggedQtypes []string + queryLogIgnoredQtypes []string blockNameFile string blockNameLogFile string blockNameFormat string diff --git a/dnscrypt-proxy/plugin_query_log.go b/dnscrypt-proxy/plugin_query_log.go index d6acfb57..60df2ee5 100644 --- a/dnscrypt-proxy/plugin_query_log.go +++ b/dnscrypt-proxy/plugin_query_log.go @@ -15,9 +15,9 @@ import ( type PluginQueryLog struct { sync.Mutex - outFd *os.File - format string - loggedQTypes []string + outFd *os.File + format string + ignoredQtypes []string } func (plugin *PluginQueryLog) Name() string { @@ -37,7 +37,7 @@ func (plugin *PluginQueryLog) Init(proxy *Proxy) error { } plugin.outFd = outFd plugin.format = proxy.queryLogFormat - plugin.loggedQTypes = proxy.queryLogLoggedQtypes + plugin.ignoredQtypes = proxy.queryLogIgnoredQtypes return nil } @@ -60,17 +60,12 @@ func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) err if !ok { qType = string(qType) } - if len(plugin.loggedQTypes) > 0 { - found := false - for _, loggedQtype := range plugin.loggedQTypes { - if strings.EqualFold(loggedQtype, qType) { - found = true - break + if len(plugin.ignoredQtypes) > 0 { + for _, ignoredQtype := range plugin.ignoredQtypes { + if strings.EqualFold(ignoredQtype, qType) { + return nil } } - if !found { - return nil - } } var clientIPStr string if pluginsState.clientProto == "udp" {