aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm/stat_convert.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-27 12:56:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-27 12:56:05 +0100
commitc4afaa5c5ea70b73f50bf307004d3589825fd9aa (patch)
tree7a9ce58a520930653be9e93b6e7851d2e9d60702 /src/rspamadm/stat_convert.c
parent6c28bbc16ba4b122f5ed16f748883818e32a410b (diff)
downloadrspamd-c4afaa5c5ea70b73f50bf307004d3589825fd9aa.tar.gz
rspamd-c4afaa5c5ea70b73f50bf307004d3589825fd9aa.zip
[Feature] Allow to reset redis tokens instead of appendig values
Diffstat (limited to 'src/rspamadm/stat_convert.c')
-rw-r--r--src/rspamadm/stat_convert.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rspamadm/stat_convert.c b/src/rspamadm/stat_convert.c
index ae4b00ecf..48acbc9bd 100644
--- a/src/rspamadm/stat_convert.c
+++ b/src/rspamadm/stat_convert.c
@@ -24,6 +24,7 @@ static gchar *symbol = NULL;
static gchar *cache_db = NULL;
static gchar *redis_db = NULL;
static gchar *redis_password = NULL;
+static gboolean reset_previous = FALSE;
static void rspamadm_statconvert (gint argc, gchar **argv);
static const char *rspamadm_statconvert_help (gboolean full_help);
@@ -48,6 +49,8 @@ static GOptionEntry entries[] = {
"Database in redis (should be numeric)", NULL},
{"password", 'p', 0, G_OPTION_ARG_STRING, &redis_password,
"Password to connect to redis", NULL},
+ {"reset", 'r', 0, G_OPTION_ARG_NONE, &reset_previous,
+ "Reset previous data instead of appending values", NULL},
{NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
};
@@ -66,7 +69,8 @@ rspamadm_statconvert_help (gboolean full_help)
"-s: symbol in redis (e.g. BAYES_SPAM)\n"
"-c: also convert data from the learn cache\n"
"-D: output redis database\n"
- "-p: redis password\n";
+ "-p: redis password\n"
+ "-r: reset previous data instead of increasing values\n";
}
else {
help_str = "Convert statistics from sqlite3 to redis";
@@ -121,6 +125,8 @@ rspamadm_statconvert (gint argc, gchar **argv)
"redis_host", 0, false);
ucl_object_insert_key (obj, ucl_object_fromstring (symbol),
"symbol", 0, false);
+ ucl_object_insert_key (obj, ucl_object_frombool (reset_previous),
+ "reset_previous", 0, false);
if (cache_db != NULL) {
ucl_object_insert_key (obj, ucl_object_fromstring (cache_db),