From: Vsevolod Stakhov Date: Tue, 11 Jun 2019 18:24:02 +0000 (+0100) Subject: [Minor] Clickhouse: Store settings id X-Git-Tag: 2.0~794 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5931d7f03de5afd4bde419acb681f942c00cfaad;p=rspamd.git [Minor] Clickhouse: Store settings id --- diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index 1ac9398da..463637171 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -19,6 +19,7 @@ local rspamd_lua_utils = require "lua_util" local upstream_list = require "rspamd_upstream_list" local lua_util = require "lua_util" local lua_clickhouse = require "lua_clickhouse" +local lua_settings = require "lua_settings" local fun = require "fun" local N = "clickhouse" @@ -613,6 +614,20 @@ local function clickhouse_collect(task) end local auth_user = task:get_user() or '' + local settings_id = task:get_settings_id() + + if settings_id then + -- Convert to string + settings_id = lua_settings.settings_by_id(settings_id) + + if settings_id then + settings_id = settings_id.name + end + end + + if not settings_id then + settings_id = '' + end local row = { today(timestamp), @@ -645,7 +660,7 @@ local function clickhouse_collect(task) scan_virtual, custom_action, auth_user, - '' -- TODO: Add settings id support + settings_id } -- Attachments step diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index da9a56553..838bb9953 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -25,7 +25,6 @@ end local rspamd_logger = require "rspamd_logger" local rspamd_maps = require "lua_maps" local lua_util = require "lua_util" -local rspamd_util = require "rspamd_util" local rspamd_ip = require "rspamd_ip" local rspamd_regexp = require "rspamd_regexp" local lua_selectors = require "lua_selectors"