eve/dns: don't log warning if dns log version not set

If the DNS log version is not set, we default to v2. This should
not be warning, but better logged at the config level.

A warning will still be logged if the value is set but is not
1 or 2.
pull/4319/head
Jason Ish 5 years ago committed by Victor Julien
parent 989a6461b0
commit 6eada54fc8

@ -510,6 +510,10 @@ static DnsVersion JsonDnsParseVersion(ConfNode *conf)
DnsVersion version = DNS_VERSION_DEFAULT;
intmax_t config_version;
const ConfNode *has_version = ConfNodeLookupChild(conf, "version");
if (has_version != NULL) {
bool invalid = false;
if (ConfGetChildValueInt(conf, "version", &config_version)) {
switch(config_version) {
case 1:
@ -519,19 +523,23 @@ static DnsVersion JsonDnsParseVersion(ConfNode *conf)
version = DNS_VERSION_2;
break;
default:
SCLogWarning(SC_ERR_INVALID_ARGUMENT,
"invalid eve-log dns version option: %"PRIuMAX", "
"forcing it to version %u",
config_version, DNS_VERSION_DEFAULT);
version = DNS_VERSION_DEFAULT;
invalid = true;
break;
}
} else {
invalid = true;
}
if (invalid) {
SCLogWarning(SC_ERR_INVALID_ARGUMENT,
"eve-log dns version not found, forcing it to version %u",
DNS_VERSION_DEFAULT);
version = DNS_VERSION_DEFAULT;
"invalid eve-log dns version option: %s, "
"defaulting to version %u",
has_version->val, version);
}
} else {
SCLogConfig("eve-log dns version not set, defaulting to version %u",
version);
}
return version;
}

Loading…
Cancel
Save