From: Jason Ish Date: Wed, 13 Jun 2018 22:36:49 +0000 (-0600) Subject: eve: check if enabled before attempting to setup X-Git-Tag: suricata-4.1.0-rc1~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05e20c5c57b31e4a4b5d6b33b8acfdf874e809ed;p=thirdparty%2Fsuricata.git eve: check if enabled before attempting to setup Before setting up a sub eve-logger, check that it is enabled. This allows us to set "enabled: no" for loggers that are not registered with the system without generating an error. An example of this is loggers that are only available with Rust. --- diff --git a/src/runmodes.c b/src/runmodes.c index 53b8bbda63..6001fe37ca 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -609,6 +609,15 @@ static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx) char subname[256]; snprintf(subname, sizeof(subname), "eve-log.%s", type->val); + ConfNode *sub_output_config = ConfNodeLookupChild(type, type->val); + if (sub_output_config != NULL) { + const char *enabled = ConfNodeLookupChildValue( + sub_output_config, "enabled"); + if (enabled != NULL && !ConfValIsTrue(enabled)) { + continue; + } + } + /* Now setup all registers logger of this name. */ OutputModule *sub_module; TAILQ_FOREACH(sub_module, &output_modules, entries) { @@ -624,9 +633,6 @@ static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx) FatalError(SC_ERR_INVALID_ARGUMENT, "bad sub-module for %s", subname); } - ConfNode *sub_output_config = - ConfNodeLookupChild(type, type->val); - // sub_output_config may be NULL if no config /* pass on parent output_ctx */ OutputInitResult result =