From f5b203c98ace2eb818f8497af293bea2967ed83d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 18 Oct 2019 11:51:17 +0100 Subject: [PATCH] [Minor] Lua_scanners: Improve logging --- lualib/lua_scanners/clamav.lua | 4 ++-- lualib/lua_scanners/dcc.lua | 7 ++----- lualib/lua_scanners/fprot.lua | 3 ++- lualib/lua_scanners/kaspersky_av.lua | 4 ++-- lualib/lua_scanners/oletools.lua | 8 ++------ lualib/lua_scanners/savapi.lua | 5 ++--- lualib/lua_scanners/sophos.lua | 4 ++-- 7 files changed, 14 insertions(+), 21 deletions(-) diff --git a/lualib/lua_scanners/clamav.lua b/lualib/lua_scanners/clamav.lua index 352d4dcbf..855eefac9 100644 --- a/lualib/lua_scanners/clamav.lua +++ b/lualib/lua_scanners/clamav.lua @@ -103,8 +103,8 @@ local function clamav_check(task, content, digest, rule) upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, '%s: retry IP: %s', - rule.log_prefix, addr) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, diff --git a/lualib/lua_scanners/dcc.lua b/lualib/lua_scanners/dcc.lua index ac7915990..e82c97cfc 100644 --- a/lualib/lua_scanners/dcc.lua +++ b/lualib/lua_scanners/dcc.lua @@ -146,15 +146,12 @@ local function dcc_check(task, content, digest, rule) retransmits = retransmits - 1 - lua_util.debugm(rule.name, task, '%s: Request Error: %s - retries left: %s', - rule.log_prefix, err, retransmits) - -- Select a different upstream! upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, '%s: retry IP: %s:%s', - rule.log_prefix, addr, addr:get_port()) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, diff --git a/lualib/lua_scanners/fprot.lua b/lualib/lua_scanners/fprot.lua index c42618434..8baaeedde 100644 --- a/lualib/lua_scanners/fprot.lua +++ b/lualib/lua_scanners/fprot.lua @@ -103,7 +103,8 @@ local function fprot_check(task, content, digest, rule) upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, '%s [%s]: retry IP: %s', rule['symbol'], rule['type'], addr) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, diff --git a/lualib/lua_scanners/kaspersky_av.lua b/lualib/lua_scanners/kaspersky_av.lua index cb94c38da..4bdbdbbfd 100644 --- a/lualib/lua_scanners/kaspersky_av.lua +++ b/lualib/lua_scanners/kaspersky_av.lua @@ -122,8 +122,8 @@ local function kaspersky_check(task, content, digest, rule) upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, - '%s [%s]: retry IP: %s', rule['symbol'], rule['type'], addr) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, diff --git a/lualib/lua_scanners/oletools.lua b/lualib/lua_scanners/oletools.lua index 8474a1847..05ef15ad9 100644 --- a/lualib/lua_scanners/oletools.lua +++ b/lualib/lua_scanners/oletools.lua @@ -106,16 +106,12 @@ local function oletools_check(task, content, digest, rule) retransmits = retransmits - 1 - lua_util.debugm(rule.name, task, - '%s: Request Error: %s - retries left: %s', - rule.log_prefix, error, retransmits) - -- Select a different upstream! upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, '%s: retry IP: %s:%s', - rule.log_prefix, addr, addr:get_port()) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, diff --git a/lualib/lua_scanners/savapi.lua b/lualib/lua_scanners/savapi.lua index a8b7b6376..67ded438e 100644 --- a/lualib/lua_scanners/savapi.lua +++ b/lualib/lua_scanners/savapi.lua @@ -210,9 +210,8 @@ local function savapi_check(task, content, digest, rule) upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, - '%s [%s]: retry IP: %s', rule['symbol'], - rule['type'], addr) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, diff --git a/lualib/lua_scanners/sophos.lua b/lualib/lua_scanners/sophos.lua index ee0407f9b..9da931c4e 100644 --- a/lualib/lua_scanners/sophos.lua +++ b/lualib/lua_scanners/sophos.lua @@ -102,8 +102,8 @@ local function sophos_check(task, content, digest, rule) upstream = rule.upstreams:get_upstream_round_robin() addr = upstream:get_addr() - lua_util.debugm(rule.name, task, - '%s [%s]: retry IP: %s', rule['symbol'], rule['type'], addr) + lua_util.debugm(rule.name, task, '%s: error: %s; retry IP: %s; retries left: %s', + rule.log_prefix, err, addr, retransmits) tcp.request({ task = task, -- 2.39.5