]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
redis: fix reconnect in batch mode
authorEric Leblond <eric@regit.org>
Thu, 23 Jan 2020 12:10:44 +0000 (13:10 +0100)
committerVictor Julien <victor@inliniac.net>
Sat, 6 Jun 2020 12:31:55 +0000 (14:31 +0200)
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.

src/util-log-redis.c

index afc4d4858acd62cd9f35ced7b3f431799955e2f5..4c4d37f2e9177e2cbbed735489bc555e1c137a7e 100644 (file)
@@ -369,6 +369,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;