FreeBSD Bugzilla – Attachment 247881 Details for
Bug 220246
syslogd does not send RFC3164-conformant messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch with added rfc3164-strict format, against 15-CURRENT
syslogd-rfc3164-strict.patch (text/plain), 2.32 KB, created by
Michal Scigocki
on 2024-01-23 10:29:16 UTC
(
hide
)
Description:
patch with added rfc3164-strict format, against 15-CURRENT
Filename:
MIME Type:
Creator:
Michal Scigocki
Created:
2024-01-23 10:29:16 UTC
Size:
2.32 KB
patch
obsolete
>diff --git a/usr.sbin/syslogd/syslogd.8 b/usr.sbin/syslogd/syslogd.8 >index b23d0327b76c..a55154b8f078 100644 >--- a/usr.sbin/syslogd/syslogd.8 >+++ b/usr.sbin/syslogd/syslogd.8 >@@ -269,14 +269,23 @@ The values > .Ar bsd > and > .Ar rfc3164 >-are used to generate RFC 3164 log messages. >+are used to generate legacy RFC 3164 log messages. >+The values >+.Ar strict >+and >+.Ar rfc3164-strict >+are used to generate log messages using the RFC 3164 recommended format, >+where messages sent over the network include the hostname, >+and messages forwarded by a relay exclude the >+.Dq Forwarded from >+field. > The values > .Ar syslog > and > .Ar rfc5424 > are used to generate RFC 5424 log messages, > having RFC 3339 timestamps with microsecond precision. >-The default is to generate RFC 3164 log messages. >+The default is to generate legacy RFC 3164 log messages. > .It Fl o > Prefix kernel messages with the full kernel boot file as determined by > .Xr getbootfile 3 . >diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c >index 7770e97e7a2d..1425d755d63b 100644 >--- a/usr.sbin/syslogd/syslogd.c >+++ b/usr.sbin/syslogd/syslogd.c >@@ -421,6 +421,7 @@ static bool KeepKernFac; /* Keep remotely logged kernel facility */ > static bool needdofsync = true; /* Are any file(s) waiting to be fsynced? */ > static struct pidfh *pfh; > static bool RFC3164OutputFormat = true; /* Use legacy format by default. */ >+static bool RFC3164OutputFormatStrict = false; /* Use recommended format. */ > > struct iovlist; > >@@ -722,6 +723,9 @@ main(int argc, char *argv[]) > else if (strcmp(optarg, "syslog") == 0 || > strcmp(optarg, "rfc5424") == 0) > RFC3164OutputFormat = false; >+ else if (strcmp(optarg, "strict") == 0 || >+ strcmp(optarg, "rfc3164-strict") == 0) >+ RFC3164OutputFormat = RFC3164OutputFormatStrict = true; > else > usage(); > break; >@@ -2053,7 +2057,11 @@ fprintlog_rfc3164(struct filed *f, const char *hostname, const char *app_name, > iovlist_append(&il, priority_number); > iovlist_append(&il, ">"); > iovlist_append(&il, timebuf); >- if (strcasecmp(hostname, LocalHostName) != 0) { >+ if (RFC3164OutputFormatStrict) { >+ iovlist_append(&il, " "); >+ iovlist_append(&il, hostname); >+ } >+ else if (strcasecmp(hostname, LocalHostName) != 0) { > iovlist_append(&il, " Forwarded from "); > iovlist_append(&il, hostname); > iovlist_append(&il, ":");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 220246
:
183758
|
233882
| 247881