From bc3af6861a2982fe1c25139bb2d9e7ca829add84 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 9 May 2018 12:56:30 +0100 Subject: [PATCH] [Minor] Store hostname in elastic --- .idea/perl5local.xml | 6 ++++++ contrib/elastic/rspamd_template.json | 4 ++++ src/plugins/lua/elastic.lua | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 .idea/perl5local.xml diff --git a/.idea/perl5local.xml b/.idea/perl5local.xml new file mode 100644 index 000000000..1ce260035 --- /dev/null +++ b/.idea/perl5local.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/contrib/elastic/rspamd_template.json b/contrib/elastic/rspamd_template.json index c1d11478f..9119af4c7 100644 --- a/contrib/elastic/rspamd_template.json +++ b/contrib/elastic/rspamd_template.json @@ -121,6 +121,10 @@ "ignore_above": 1024, "type": "keyword" }, + "hostname": { + "ignore_above": 1024, + "type": "keyword" + }, "score": { "type": "float" }, diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua index 854f5ec64..4caedd684 100644 --- a/src/plugins/lua/elastic.lua +++ b/src/plugins/lua/elastic.lua @@ -182,11 +182,15 @@ local function get_general_metadata(task) return 'unknown' end end + r.header_from = process_header('from') r.header_to = process_header('to') r.header_subject = process_header('subject') r.header_date = process_header('date') r.message_id = task:get_message_id() + local hname = task:get_hostname() or 'unknown' + r.hostname = hname + return r end -- 2.39.5