aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-10-15 23:50:48 +0200
committerDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-10-16 10:34:43 +0200
commitffda608b2e73179e3af67f783f84eb9eb31390c3 (patch)
tree2f67f5ec51eabd97564809fa1d29316ef6eeb8a1 /src/plugins/lua
parent2f9eb903ad049da6a07f35e7515a454b22aa6655 (diff)
downloadrspamd-ffda608b2e73179e3af67f783f84eb9eb31390c3.tar.gz
rspamd-ffda608b2e73179e3af67f783f84eb9eb31390c3.zip
return item status and reasons on bulk push error
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/elastic.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua
index e90c70260..ae7e577f3 100644
--- a/src/plugins/lua/elastic.lua
+++ b/src/plugins/lua/elastic.lua
@@ -380,7 +380,17 @@ local function elastic_send_data(flush_all, task, cfg, ev_base)
push_done = true
rspamd_logger.debugm(N, log_object, 'successfully sent payload with %s logs', nlogs_to_send)
if obj['errors'] then
- rspamd_logger.debugm(N, log_object, 'faced errors while pushing logs to elastic (%s): %s', obj['errors'])
+ for _, value in pairs(obj['items']) do
+ if value['index'] and value['index']['status'] >= 400 then
+ local status = value['index']['status']
+ local index = safe_get(value, 'index', '_index') or ''
+ local error_type = safe_get(value, 'index', 'error', 'type') or ''
+ local error_reason = safe_get(value, 'index', 'error', 'reason') or ''
+ rspamd_logger.warnx(log_object,
+ 'error while pushing logs to elastic, status: %s, index: %s, type: %s, reason: %s',
+ status, index, error_type, error_reason)
+ end
+ end
end
else
rspamd_logger.errx(log_object,