This adds a new redis mode rpush. Also more consistent config keywords orientated at the redis command: lpush and publish.
Keeping list and channel config keywords for backwards compatibility
# server: 127.0.0.1
# port: 6379
# async: true ## if redis replies are read asynchronously
- # mode: list ## possible values: list (default), channel
+ # mode: list ## possible values: list|lpush (default), rpush, channel|publish
+ # ## lpush and rpush are using a Redis list. "list" is an alias for lpush
+ # ## publish is using a Redis channel. "channel" is an alias for publish
# key: suricata ## key or channel to use (default to suricata)
# Redis pipelining set up. This will enable to only do a query every
# 'batch-size' events. This should lower the latency induced by network
# server: 127.0.0.1
# port: 6379
# async: true ## if redis replies are read asynchronously
- # mode: list ## possible values: list (default), channel
+ # mode: list ## possible values: list|lpush (default), rpush, channel|publish
+ # ## lpush and rpush are using a Redis list. "list" is an alias for lpush
+ # ## publish is using a Redis channel. "channel" is an alias for publish
# key: suricata ## key or channel to use (default to suricata)
# Redis pipelining set up. This will enable to only do a query every
# 'batch-size' events. This should lower the latency induced by network
# server: 127.0.0.1
# port: 6379
# async: true ## if redis replies are read asynchronously
- # mode: list ## possible values: list (default), channel
+ # mode: list ## possible values: list|lpush (default), rpush, channel|publish
+ # ## lpush and rpush are using a Redis list. "list" is an alias for lpush
+ # ## publish is using a Redis channel. "channel" is an alias for publish
# key: suricata ## key or channel to use (default to suricata)
# Redis pipelining set up. This will enable to only do a query every
# 'batch-size' events. This should lower the latency induced by network
CASE_CODE (SC_WARN_LOG_CF_TOO_MANY_NODES);
CASE_CODE (SC_WARN_EVENT_DROPPED);
CASE_CODE (SC_ERR_NO_REDIS_ASYNC);
+ CASE_CODE (SC_ERR_REDIS_CONFIG);
}
return "UNKNOWN_ERROR";
SC_WARN_CHMOD,
SC_WARN_LOG_CF_TOO_MANY_NODES,
SC_WARN_EVENT_DROPPED,
- SC_ERR_NO_REDIS_ASYNC
+ SC_ERR_NO_REDIS_ASYNC,
+ SC_ERR_REDIS_CONFIG
} SCError;
const char *SCErrorToString(SCError);
#include <event2/thread.h>
#endif /* HAVE_LIBEVENT_PTHREADS */
-static const char * redis_push_cmd = "LPUSH";
+static const char * redis_lpush_cmd = "LPUSH";
+static const char * redis_rpush_cmd = "RPUSH";
static const char * redis_publish_cmd = "PUBLISH";
static const char * redis_default_key = "suricata";
static const char * redis_default_server = "127.0.0.1";
log_ctx->redis_setup.batch_size = 0;
}
- if (!strcmp(redis_mode, "list")) {
- log_ctx->redis_setup.command = redis_push_cmd;
- } else {
+ if (!strcmp(redis_mode, "list") || !strcmp(redis_mode,"lpush")) {
+ log_ctx->redis_setup.command = redis_lpush_cmd;
+ } else if(!strcmp(redis_mode, "rpush")){
+ log_ctx->redis_setup.command = redis_rpush_cmd;
+ } else if(!strcmp(redis_mode,"channel") || !strcmp(redis_mode,"publish")) {
log_ctx->redis_setup.command = redis_publish_cmd;
+ } else {
+ SCLogError(SC_ERR_REDIS_CONFIG,"Invalid redis mode");
+ exit(EXIT_FAILURE);
}
+
/* store server params for reconnection */
if (!log_ctx->redis_setup.server) {
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating redis server string");
# server: 127.0.0.1
# port: 6379
# async: true ## if redis replies are read asynchronously
- # mode: list ## possible values: list (default), channel
+ # mode: list ## possible values: list|lpush (default), rpush, channel|publish
+ # ## lpush and rpush are using a Redis list. "list" is an alias for lpush
+ # ## publish is using a Redis channel. "channel" is an alias for publish
# key: suricata ## key or channel to use (default to suricata)
# Redis pipelining set up. This will enable to only do a query every
# 'batch-size' events. This should lower the latency induced by network