diff options
author | John Crispin <blogic@openwrt.org> | 2014-09-16 14:20:30 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-09-16 14:20:30 +0200 |
commit | 5c45b560bc8c9e13682269ed963a8a4a65959518 (patch) | |
tree | 2a1c8caae830cc0160a67796478da02167616dd1 /log | |
parent | 06cbdf5bed92313498ea9a21a747777a2907f897 (diff) | |
download | ubox-5c45b560bc8c9e13682269ed963a8a4a65959518.tar.gz |
RFC 3164 compliant remote logging
When logread daemon send a syslog message to another host, time, severity and facility are cut off.
The message contains only text. This patch adds time, severity and facility in the message as described in the RFC 3164.
Signed-off-by: Belkov Max <belkov-max@mail.ru>
Diffstat (limited to 'log')
-rw-r--r-- | log/logread.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/log/logread.c b/log/logread.c index 28c9462..a7ab567 100644 --- a/log/logread.c +++ b/log/logread.c @@ -135,9 +135,12 @@ static int log_notify(struct blob_attr *msg) if (log_type == LOG_NET) { int err; - *buf = '\0'; - if (hostname) - snprintf(buf, sizeof(buf), "%s ", hostname); + snprintf(buf, sizeof(buf), "<%u>", p); + strncat(buf, c + 4, 16); + if (hostname) { + strncat(buf, hostname, sizeof(buf)); + strncat(buf, " ", sizeof(buf)); + } if (log_prefix) { strncat(buf, log_prefix, sizeof(buf)); strncat(buf, ": ", sizeof(buf)); |