]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve: check if enabled before attempting to setup
authorJason Ish <ish@unx.ca>
Wed, 13 Jun 2018 22:36:49 +0000 (16:36 -0600)
committerJason Ish <ish@unx.ca>
Fri, 15 Jun 2018 21:48:52 +0000 (15:48 -0600)
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.

src/runmodes.c

index 53b8bbda63e2ba25ef17894d5e1315b69acfe2a3..6001fe37cae323b11f80cd8b96288b61bfb54ad4 100644 (file)
@@ -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 =