From dfc2fe8153d1dc6a4271373059f215029ca4a2e1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 12 Mar 2017 10:09:37 +0000 Subject: [PATCH] [Fix] Properly set missing fields in exporter --- src/plugins/lua/metadata_exporter.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 2bd2f833e..36e2a819a 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -60,9 +60,9 @@ Symbols: $symbols]], local function get_general_metadata(task, flatten, no_content) local r = {} - r.ip = tostring(task:get_from_ip()) - r.user = task:get_user() - r.qid = task:get_queue_id() + r.ip = tostring(task:get_from_ip()) or 'unknown' + r.user = task:get_user() or 'unknown' + r.qid = task:get_queue_id() or 'unknown' r.action = task:get_metric_action('default') r.score = task:get_metric_score('default')[1] local rcpt = task:get_recipients('smtp') @@ -76,10 +76,14 @@ local function get_general_metadata(task, flatten, no_content) else r.rcpt = table.concat(l, ', ') end + else + r.rcpt = 'unknown' end local from = task:get_from('smtp') if ((from or E)[1] or E).addr then r.from = from[1].addr + else + r.from = 'unknown' end local syminf = task:get_symbols_all() if flatten then @@ -110,6 +114,8 @@ local function get_general_metadata(task, flatten, no_content) else return table.concat(l, '\n') end + else + return 'unknown' end end if not no_content then -- 2.39.5