aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm/stat_convert.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-27 17:39:17 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-27 17:39:17 +0000
commit11d3b65b5598109f0374cb61843e66df2e5f9048 (patch)
treee86c6e1c02c4fc5de49f49de813a56a136e77f82 /src/rspamadm/stat_convert.c
parent01710012952e4839393c5ed1e6b4a04692d0af02 (diff)
downloadrspamd-11d3b65b5598109f0374cb61843e66df2e5f9048.tar.gz
rspamd-11d3b65b5598109f0374cb61843e66df2e5f9048.zip
Allow converting of learn cache from sqlite to redis
Diffstat (limited to 'src/rspamadm/stat_convert.c')
-rw-r--r--src/rspamadm/stat_convert.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rspamadm/stat_convert.c b/src/rspamadm/stat_convert.c
index 36c2d69cc..15f21f567 100644
--- a/src/rspamadm/stat_convert.c
+++ b/src/rspamadm/stat_convert.c
@@ -30,6 +30,7 @@
static gchar *source_db = NULL;
static gchar *redis_host = NULL;
static gchar *symbol = NULL;
+static gchar *cache_db = NULL;
static void rspamadm_statconvert (gint argc, gchar **argv);
static const char *rspamadm_statconvert_help (gboolean full_help);
@@ -44,6 +45,8 @@ struct rspamadm_command statconvert_command = {
static GOptionEntry entries[] = {
{"database", 'd', 0, G_OPTION_ARG_FILENAME, &source_db,
"Input sqlite", NULL},
+ {"cache", 'c', 0, G_OPTION_ARG_FILENAME, &cache_db,
+ "Input learn cache", NULL},
{"host", 'h', 0, G_OPTION_ARG_STRING, &redis_host,
"Output redis ip (in format ip:port)", NULL},
{"symbol", 's', 0, G_OPTION_ARG_STRING, &symbol,
@@ -63,7 +66,8 @@ rspamadm_statconvert_help (gboolean full_help)
"Where options are:\n\n"
"-d: input sqlite\n"
"-h: output redis ip (in format ip:port)\n"
- "-s: symbol in redis (e.g. BAYES_SPAM)\n";
+ "-s: symbol in redis (e.g. BAYES_SPAM)\n"
+ "-c: also convert data from the learn cache\n";
}
else {
help_str = "Convert statistics from sqlite3 to redis";
@@ -119,6 +123,11 @@ rspamadm_statconvert (gint argc, gchar **argv)
ucl_object_insert_key (obj, ucl_object_fromstring (symbol),
"symbol", 0, false);
+ if (cache_db != NULL) {
+ ucl_object_insert_key (obj, ucl_object_fromstring (cache_db),
+ "cache_db", 0, false);
+ }
+
rspamadm_execute_lua_ucl_subr (L,
argc,
argv,