From: Vsevolod Stakhov Date: Wed, 9 May 2018 11:56:30 +0000 (+0100) Subject: [Minor] Store hostname in elastic X-Git-Tag: 1.7.5~59 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bc3af6861a2982fe1c25139bb2d9e7ca829add84;p=rspamd.git [Minor] Store hostname in elastic --- 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