diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-05-05 22:53:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 22:53:21 +0100 |
commit | f4175571c737ebd0bef64bcf49cb09cc40f8750b (patch) | |
tree | ad730fc1867945dcbbb4678de1940bc20d56671f | |
parent | 66b22c2eee1b4c13f55c8057b3237a70baf089b0 (diff) | |
parent | 50bbb389711f7b47dcc6a34772c9040f3c0deeb9 (diff) | |
download | rspamd-f4175571c737ebd0bef64bcf49cb09cc40f8750b.tar.gz rspamd-f4175571c737ebd0bef64bcf49cb09cc40f8750b.zip |
Merge pull request #4166 from lucasRolff/master
[Minor] Add scan_time and hostname to metadata_exporter
-rw-r--r-- | src/plugins/lua/metadata_exporter.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 20d388fef..6316ddc09 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -29,6 +29,7 @@ local rspamd_logger = require "rspamd_logger" local ucl = require "ucl" local E = {} local N = 'metadata_exporter' +local HOSTNAME = rspamd_util.get_hostname() local settings = { pusher_enabled = {}, @@ -75,6 +76,7 @@ local function get_general_metadata(task, flatten, no_content) r.qid = task:get_queue_id() or 'unknown' r.subject = task:get_subject() or 'unknown' r.action = task:get_metric_action('default') + r.rspamd_server = HOSTNAME local s = task:get_metric_score('default')[1] r.score = flatten and string.format('%.2f', s) or s @@ -151,6 +153,18 @@ local function get_general_metadata(task, flatten, no_content) return 'unknown' end end + + local scan_real = task:get_scan_time() + scan_real = math.floor(scan_real * 1000) + if scan_real < 0 then + rspamd_logger.messagex(task, + 'clock skew detected for message: %s ms real sca time (reset to 0)', + scan_real) + scan_real = 0 + end + + r.scan_time = scan_real + if not no_content then r.header_from = process_header('from') r.header_to = process_header('to') |