summaryrefslogtreecommitdiff
path: root/syslogd/proto.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-06-17 16:48:50 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-06-17 18:20:53 +0200
commit9878e69ebe5b18676f8f5e26ef57d2e47b02e44d (patch)
tree0205ed51f570e2db855fb34b51fe3e7d5a806b9d /syslogd/proto.c
parent8a8f49a501fd109bcb722afff7eb2c7852a04107 (diff)
usyslogd: store logs in subdirectory based on service identifier
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'syslogd/proto.c')
-rw-r--r--syslogd/proto.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/syslogd/proto.c b/syslogd/proto.c
index 3487dbd..8a285dd 100644
--- a/syslogd/proto.c
+++ b/syslogd/proto.c
@@ -169,9 +169,20 @@ int syslog_msg_parse(syslog_msg_t *msg, char *str)
ident = NULL;
}
+ if (ident != NULL && ident[0] == '\0')
+ ident = NULL;
+
msg->timestamp = mktime(&tstamp);
msg->pid = pid;
msg->ident = ident;
msg->message = str;
+
+ if (ident != NULL) {
+ for (ptr = ident; *ptr != '\0'; ++ptr) {
+ if (!isalnum(*ptr))
+ *ptr = '_';
+ }
+ }
+
return 0;
}