diff options
Diffstat (limited to 'syslogd/main.c')
-rw-r--r-- | syslogd/main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/syslogd/main.c b/syslogd/main.c index 79d6325..263c87d 100644 --- a/syslogd/main.c +++ b/syslogd/main.c @@ -134,12 +134,16 @@ static int print_to_log(const syslog_msg_t *msg) return -1; for (log = logfiles; log != NULL; log = log->next) { - if (log->facility == msg->facility) + if (log->facility != msg->facility) + continue; + if (msg->ident == NULL && log->ident[0] == '\0') + break; + if (msg->ident != NULL && strcmp(msg->ident, log->ident) == 0) break; } if (log == NULL) { - log = logfile_create(fac_name, msg->facility); + log = logfile_create(msg->ident, fac_name, msg->facility); if (log == NULL) return -1; log->next = logfiles; @@ -149,8 +153,7 @@ static int print_to_log(const syslog_msg_t *msg) gmtime_r(&msg->timestamp, &tm); strftime(timebuf, sizeof(timebuf), "%FT%T", &tm); - logfile_write(log, "[%s][%s][%s][%u] %s", timebuf, lvl_str, - msg->ident ? msg->ident : "", msg->pid, + logfile_write(log, "[%s][%s][%u] %s", timebuf, lvl_str, msg->pid, msg->message); return 0; } |