commit 5931d7f: [Minor] Clickhouse: Store settings id
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Jun 11 18:28:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-06-11 19:24:02 +0100
URL: https://github.com/rspamd/rspamd/commit/5931d7f03de5afd4bde419acb681f942c00cfaad (HEAD -> master)
[Minor] Clickhouse: Store settings id
---
src/plugins/lua/clickhouse.lua | 17 ++++++++++++++++-
src/plugins/lua/settings.lua | 1 -
2 files changed, 16 insertions(+), 2 deletions(-)
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"
More information about the Commits
mailing list