]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
redis: support for all output types 2467/head
authorVictor Julien <victor@inliniac.net>
Tue, 22 Nov 2016 20:46:20 +0000 (21:46 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 20 Dec 2016 10:47:13 +0000 (11:47 +0100)
src/util-error.c
src/util-error.h
src/util-logopenfile.c

index b7fc7b929371d68dab43b0ebeaa67cca462b5a8a..105add555dc628a80546044db0896ff0ba5a7256 100644 (file)
@@ -334,6 +334,7 @@ const char * SCErrorToString(SCError err)
         CASE_CODE (SC_ERR_DIR_OPEN);
         CASE_CODE(SC_WARN_REMOVE_FILE);
         CASE_CODE (SC_ERR_NO_MAGIC_SUPPORT);
+        CASE_CODE (SC_ERR_REDIS);
     }
 
     return "UNKNOWN_ERROR";
index 2a825b18ba94e2e99e1236761a4a7639da57f418..acaec8162567dc385afa82f00bdd334f0b706f59 100644 (file)
@@ -324,6 +324,7 @@ typedef enum {
     SC_ERR_DIR_OPEN,
     SC_WARN_REMOVE_FILE,
     SC_ERR_NO_MAGIC_SUPPORT,
+    SC_ERR_REDIS,
 } SCError;
 
 const char *SCErrorToString(SCError);
index 8eac7e1ee078c709a7025ff6f6984ac4afeaeff9..636aaab83f5dfdfab536c7dc75425505de2d0fc5 100644 (file)
@@ -280,6 +280,15 @@ SCConfLogOpenGeneric(ConfNode *conf,
         log_ctx->pcie_fp = SCLogOpenPcieFp(log_ctx, log_path, append);
         if (log_ctx->pcie_fp == NULL)
             return -1; // Error already logged by Open...Fp routine
+#ifdef HAVE_LIBHIREDIS
+    } else if (strcasecmp(filetype, "redis") == 0) {
+        ConfNode *redis_node = ConfNodeLookupChild(conf, "redis");
+        if (SCConfLogOpenRedis(redis_node, log_ctx) < 0) {
+            SCLogError(SC_ERR_REDIS, "failed to open redis output");
+            return -1;
+        }
+        log_ctx->type = LOGFILE_TYPE_REDIS;
+#endif
     } else {
         SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid entry for "
                    "%s.filetype.  Expected \"regular\" (default), \"unix_stream\", "