commit 5a56747: [Minor] Fix some minor issues
Vsevolod Stakhov
vsevolod at rspamd.com
Mon Oct 30 17:21:04 UTC 2023
Author: Vsevolod Stakhov
Date: 2023-10-30 15:48:52 +0000
URL: https://github.com/rspamd/rspamd/commit/5a567472420dd6c3e47943cbca0ac527b0045eaa
[Minor] Fix some minor issues
---
src/libserver/logger/logger.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libserver/logger/logger.c b/src/libserver/logger/logger.c
index 58cb31969..7a6f62ddd 100644
--- a/src/libserver/logger/logger.c
+++ b/src/libserver/logger/logger.c
@@ -1090,11 +1090,13 @@ gsize rspamd_log_fill_iov(struct iovec *iov,
if (G_UNLIKELY(log_json)) {
/* Perform JSON logging */
+ guint slen = id ? strlen(id) : strlen("(NULL)");
+ slen = MIN(RSPAMD_LOG_ID_LEN, slen);
r = rspamd_snprintf(tmpbuf, sizeof(tmpbuf), "{\"ts\": %L, "
"\"pid\": %P, "
"\"severity\": \"%s\", "
"\"worker_type\": \"%s\", "
- "\"id\": \"%s\", "
+ "\"id\": \"%*.s\", "
"\"module\": \"%s\", "
"\"function\": \"%s\", "
"\"message\": \"",
@@ -1102,7 +1104,7 @@ gsize rspamd_log_fill_iov(struct iovec *iov,
logger->pid,
rspamd_get_log_severity_string(level_flags),
logger->process_type,
- id,
+ slen, id,
module,
function);
iov[0].iov_base = tmpbuf;
@@ -1111,6 +1113,8 @@ gsize rspamd_log_fill_iov(struct iovec *iov,
iov[1].iov_len = mlen;
iov[2].iov_base = (void *) "\"}\n";
iov[2].iov_len = sizeof("\"}\n") - 1;
+
+ return 3;
}
else if (G_LIKELY(!log_rspamadm)) {
if (!log_systemd) {
More information about the Commits
mailing list