@@ -202,6 +202,7 @@ struct rspamd_config { | |||
GHashTable *debug_modules; /**< logging modules to debug */ | |||
gboolean log_color; /**< output colors for console output */ | |||
gboolean log_extended; /**< log extended information */ | |||
gboolean log_systemd; /**< special case for systemd logger */ | |||
gboolean mlock_statfile_pool; /**< use mlock (2) for locking statfiles */ | |||
@@ -1190,6 +1190,16 @@ rspamd_rcl_config_init (void) | |||
rspamd_rcl_parse_struct_boolean, | |||
G_STRUCT_OFFSET (struct rspamd_config, log_color), | |||
0); | |||
rspamd_rcl_add_default_handler (sub, | |||
"log_systemd", | |||
rspamd_rcl_parse_struct_boolean, | |||
G_STRUCT_OFFSET (struct rspamd_config, log_systemd), | |||
0); | |||
rspamd_rcl_add_default_handler (sub, | |||
"systemd", | |||
rspamd_rcl_parse_struct_boolean, | |||
G_STRUCT_OFFSET (struct rspamd_config, log_systemd), | |||
0); | |||
rspamd_rcl_add_default_handler (sub, | |||
"debug_modules", | |||
rspamd_rcl_parse_struct_string_list, |
@@ -748,9 +748,12 @@ file_log_function (const gchar *log_domain, | |||
} | |||
/* Format time */ | |||
tms = localtime (&now); | |||
if (!rspamd_log->cfg->log_systemd) { | |||
tms = localtime (&now); | |||
strftime (timebuf, sizeof (timebuf), "%F %H:%M:%S", tms); | |||
} | |||
strftime (timebuf, sizeof (timebuf), "%F %H:%M:%S", tms); | |||
cptype = g_quark_to_string (rspamd_log->process_type); | |||
if (rspamd_log->cfg->log_color) { | |||
@@ -771,12 +774,20 @@ file_log_function (const gchar *log_domain, | |||
r = 0; | |||
} | |||
r += rspamd_snprintf (tmpbuf + r, | |||
sizeof (tmpbuf) - r, | |||
"%s #%P(%s) ", | |||
timebuf, | |||
rspamd_log->pid, | |||
cptype); | |||
if (!rspamd_log->cfg->log_systemd) { | |||
r += rspamd_snprintf (tmpbuf + r, | |||
sizeof (tmpbuf) - r, | |||
"%s #%P(%s) ", | |||
timebuf, | |||
rspamd_log->pid, | |||
cptype); | |||
} | |||
else { | |||
r += rspamd_snprintf (tmpbuf + r, | |||
sizeof (tmpbuf) - r, | |||
"(%s) ", | |||
cptype); | |||
} | |||
modulebuf[0] = '\0'; | |||
mremain = sizeof (modulebuf); |