summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-09 12:56:30 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-09 12:56:30 +0100
commitbc3af6861a2982fe1c25139bb2d9e7ca829add84 (patch)
treeb5ddfb2ddc36552a562301dedacd75d398fe0e66
parentb563e16adb19086f99f9ecf6b3c3636f44229758 (diff)
downloadrspamd-bc3af6861a2982fe1c25139bb2d9e7ca829add84.tar.gz
rspamd-bc3af6861a2982fe1c25139bb2d9e7ca829add84.zip
[Minor] Store hostname in elastic
-rw-r--r--.idea/perl5local.xml6
-rw-r--r--contrib/elastic/rspamd_template.json4
-rw-r--r--src/plugins/lua/elastic.lua4
3 files changed, 14 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Perl5LocalSettings">
+ <option name="DISABLE_ASSOCIATIONS_CHECKING" value="true" />
+ </component>
+</project> \ 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