]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix pushing country to clickhouse asn table
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 2 Aug 2017 17:12:17 +0000 (18:12 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 2 Aug 2017 17:12:17 +0000 (18:12 +0100)
src/plugins/lua/clickhouse.lua

index 3af60a7a069b6de14337180ea66837b4a5cb86b9..08fb25c8c393ac43e00e915a66d44185c30797b9 100644 (file)
@@ -573,7 +573,7 @@ local function clickhouse_collect(task)
 
   -- ASN information
   if settings['asn_table'] then
-    local asn, country, ipnet = 'unknown', 'unknown', 'unknown'
+    local asn, country, ipnet = 'UN', 'UN', 'UN'
     local pool = task:get_mempool()
     ret = pool:get_variable("asn")
     if ret then
@@ -581,7 +581,7 @@ local function clickhouse_collect(task)
     end
     ret = pool:get_variable("country")
     if ret then
-      country = ret
+      country = ret:sub(1, 2)
     end
     ret = pool:get_variable("ipnet")
     if ret then