aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-10-14 16:16:44 +0200
committerDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-10-14 16:16:44 +0200
commit0a73f356e6af18d1f78534667a4bd298bb08ce19 (patch)
tree1397c9db003581ac419426c3842e42a80e992abc /src/plugins
parent6387273113ff352d6036dbcde445e196c7db3a08 (diff)
downloadrspamd-0a73f356e6af18d1f78534667a4bd298bb08ce19.tar.gz
rspamd-0a73f356e6af18d1f78534667a4bd298bb08ce19.zip
round time_diff to seconds on interval check, improve log message readability
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/elastic.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua
index 45c5c2edf..18c29711f 100644
--- a/src/plugins/lua/elastic.lua
+++ b/src/plugins/lua/elastic.lua
@@ -658,9 +658,10 @@ local function periodic_send_data(cfg, ev_base)
local first_row = buffer['logs']:get(1)
if first_row then
local time_diff = now - first_row['@timestamp']
- if time_diff > settings.limits.max_interval * 1000 then
- rspamd_logger.infox(rspamd_config, 'flushing buffer by reaching max interval, diff: %s, current time: %s, log timestamp: %s',
- time_diff, now, first_row['@timestamp'])
+ local time_diff_sec = lua_util.round((time_diff / 1000), 1)
+ if time_diff_sec > settings.limits.max_interval then
+ rspamd_logger.infox(rspamd_config, 'flushing buffer for %s by reaching max interval, oldest log in buffer written %s sec ago',
+ time_diff_sec, first_row['@timestamp'])
flush_needed = true
else
local size = buffer['logs']:size()