]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-log-redis: fix reconnect in batch mode
authorEric Leblond <eric@regit.org>
Thu, 23 Jan 2020 12:10:44 +0000 (13:10 +0100)
committerJeff Lucovsky <jeff@lucovsky.org>
Sun, 5 Jul 2020 15:40:54 +0000 (11:40 -0400)
In case of redis outage, the redis session was reset but the replies
were still fetch even if there is none replies in the new session.

(cherry picked from commit 21431f166c337a7d3dd8ff8cc3aacbe686414ae3)

src/util-log-redis.c

index b6ff2b6717c0bdf2369fc9953d64474c6386f716..5259b18da4665afd042bd2d76d98a3f57b8e1367 100644 (file)
@@ -360,6 +360,12 @@ static int SCLogRedisWriteSync(LogFileCtx *file_ctx, const char *string)
                             redis = ctx->sync;
                             if (redis) {
                                 SCLogInfo("Reconnected to redis server");
+                                redisAppendCommand(redis, "%s %s %s",
+                                        file_ctx->redis_setup.command,
+                                        file_ctx->redis_setup.key,
+                                        string);
+                                ctx->batch_count++;
+                                return 0;
                             } else {
                                 SCLogInfo("Unable to reconnect to redis server");
                                 return -1;