aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/clickhouse.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-10 11:29:55 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-10 11:29:55 +0100
commitc92f84d76e32100d6f5e1767a468cf3fe49a5db7 (patch)
treebc88432be97df1c816ebd7dfb97e89974291df94 /src/plugins/lua/clickhouse.lua
parent614b48d55f1a4084fd4ef9de95603ba4334e6837 (diff)
downloadrspamd-c92f84d76e32100d6f5e1767a468cf3fe49a5db7.tar.gz
rspamd-c92f84d76e32100d6f5e1767a468cf3fe49a5db7.zip
[Feature] Store Clickhouse data outside of lua alloc
Diffstat (limited to 'src/plugins/lua/clickhouse.lua')
-rw-r--r--src/plugins/lua/clickhouse.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 1505b51aa..45c555460 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -421,12 +421,13 @@ local function clickhouse_send_data(task, ev_base)
end
send_data('generic data', data_rows,
- string.format('INSERT INTO rspamd (%s)', table.concat(fields, ',')))
+ string.format('INSERT INTO rspamd (%s)',
+ table.concat(fields, ',')))
for k,crows in pairs(custom_rows) do
if #crows > 1 then
- send_data('custom data ('..k..')', settings.custom_rules[k].first_row(),
- crows)
+ send_data('custom data ('..k..')', crows,
+ settings.custom_rules[k].first_row())
end
end
end
@@ -823,11 +824,11 @@ local function clickhouse_collect(task)
-- Custom data
for k,rule in pairs(settings.custom_rules) do
if not custom_rows[k] then custom_rows[k] = {} end
- table.insert(custom_rows[k], rule.get_row(task))
+ table.insert(custom_rows[k], lua_clickhouse.row_to_tsv(rule.get_row(task)))
end
nrows = nrows + 1
- table.insert(data_rows, row)
+ data_rows[#data_rows + 1] = lua_clickhouse.row_to_tsv(row)
lua_util.debugm(N, task, "add clickhouse row %s / %s", nrows, settings.limit)
if nrows >= settings['limit'] then