aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Yuzhaninov <citrin+github@citrin.ru>2019-06-24 17:02:15 +0100
committerAnton Yuzhaninov <citrin+github@citrin.ru>2019-06-24 17:02:15 +0100
commit3c4d34b9441e6cd1ed4135db2a336e3f7ed4d72c (patch)
tree7368effcb7bf84aa015d599e143e9f85cc3c81b0
parent4977a84b1835cd67ed2a909fd91b52375ec2fb53 (diff)
downloadrspamd-3c4d34b9441e6cd1ed4135db2a336e3f7ed4d72c.tar.gz
rspamd-3c4d34b9441e6cd1ed4135db2a336e3f7ed4d72c.zip
[Rework] Store ASN as UInt32 in ClickHouse
Using integer type for an integer value will simplify queries. Value for unknown ASN changes from '--' to 0.
-rw-r--r--src/plugins/lua/clickhouse.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index ff46d80fe..9c8f7b631 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -123,7 +123,7 @@ CREATE TABLE rspamd
`Urls.Tld` Array(String) COMMENT 'Effective second level domain part of the URL host',
`Urls.Url` Array(String) COMMENT 'Full URL if `full_urls` module option enabled, host part of URL otherwise',
Emails Array(String) COMMENT 'List of emails extracted from the message',
- ASN String COMMENT 'BGP AS number for SMTP client IP (returned by asn.rspamd.com or asn6.rspamd.com)',
+ ASN UInt32 COMMENT 'BGP AS number for SMTP client IP (returned by asn.rspamd.com or asn6.rspamd.com)',
Country LowCardinality(FixedString(2)) COMMENT 'Country for SMTP client IP (returned by asn.rspamd.com or asn6.rspamd.com)',
IPNet String,
`Symbols.Names` Array(LowCardinality(String)) COMMENT 'Symbol name',
@@ -158,7 +158,7 @@ local migrations = {
ADD COLUMN `Urls.Tld` Array(String) AFTER `Attachments.Digest`,
ADD COLUMN `Urls.Url` Array(String) AFTER `Urls.Tld`,
ADD COLUMN Emails Array(String) AFTER `Urls.Url`,
- ADD COLUMN ASN String AFTER Emails,
+ ADD COLUMN ASN UInt32 AFTER Emails,
ADD COLUMN Country FixedString(2) AFTER ASN,
ADD COLUMN IPNet String AFTER Country,
ADD COLUMN `Symbols.Names` Array(String) AFTER IPNet,
@@ -731,7 +731,7 @@ local function clickhouse_collect(task)
end
-- ASN information
- local asn, country, ipnet = '--', '--', '--'
+ local asn, country, ipnet = 0, '--', '--'
local pool = task:get_mempool()
ret = pool:get_variable("asn")
if ret then