Replace logged_qtypes with ignored_qtypes
This commit is contained in:
parent
5080502381
commit
066db6a080
|
@ -78,7 +78,7 @@ type SourceConfig struct {
|
|||
type QueryLogConfig struct {
|
||||
File string
|
||||
Format string
|
||||
LoggedQtypes []string `toml:"logged_qtypes"`
|
||||
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"
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
||||
######################################################
|
||||
|
|
|
@ -38,7 +38,7 @@ type Proxy struct {
|
|||
cacheMaxTTL uint32
|
||||
queryLogFile string
|
||||
queryLogFormat string
|
||||
queryLogLoggedQtypes []string
|
||||
queryLogIgnoredQtypes []string
|
||||
blockNameFile string
|
||||
blockNameLogFile string
|
||||
blockNameFormat string
|
||||
|
|
|
@ -17,7 +17,7 @@ type PluginQueryLog struct {
|
|||
sync.Mutex
|
||||
outFd *os.File
|
||||
format string
|
||||
loggedQTypes []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,18 +60,13 @@ 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 !found {
|
||||
if len(plugin.ignoredQtypes) > 0 {
|
||||
for _, ignoredQtype := range plugin.ignoredQtypes {
|
||||
if strings.EqualFold(ignoredQtype, qType) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
var clientIPStr string
|
||||
if pluginsState.clientProto == "udp" {
|
||||
clientIPStr = (*pluginsState.clientAddr).(*net.UDPAddr).IP.String()
|
||||
|
|
Loading…
Reference in New Issue