Skip to content

Commit 272c056

Browse files
committed
Readme: Update SYSLOG_MSGID= and SYSLOG_STRUCTURED_DATA=
1 parent 0e80e26 commit 272c056

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

README.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,81 @@ systemd-netlogd reads configuration files named `/etc/systemd/netlogd.conf` and
4747
to a unicast UDP address or multicast UDP network group in syslog RFC 5424 format.
4848

4949
The the address string format is similar to socket units. See systemd.socket(1)
50-
50+
5151
Protocol=
5252
Specifies whether to use udp or tcp protocol. Defaults to udp.
53-
54-
LogFormat=
53+
54+
LogFormat=
5555
Specifies whether to use RFC 5424 format or RFC 3339 format. Takes one of rfc5424 or rfc3339. Defaults to rfc5424.
5656
Optional settings
5757

5858
StructuredData=
5959
Meta information about the syslog message, which can be used for Cloud Based
6060
syslog servers, such as Loggly
6161

62+
UseSysLogStructuredData=
63+
A boolean. Specifies whether to extract ```SYSLOG_STRUCTURED_DATA=``` from journal. Defaults to false.
64+
65+
UseSysLogMsgId=
66+
A boolean. Specifies whether to extract ```SYSLOG_MSGID=``` from journal. Defaults to false.
67+
68+
6269
**EXAMPLE**
6370

6471
Example 1. /etc/systemd/netlogd.conf
6572

73+
``` sh
6674
[Network]
6775
Address=239.0.0.1:6000
6876
#Protocol=udp
6977
#LogFormat=rfc5424
78+
79+
```
80+
7081
Example 2. /etc/systemd/netlogd.conf
7182

83+
``` sh
7284
[Network]
7385
Address=192.168.8.101:514
7486
#Protocol=udp
7587
LogFormat=rfc3339
7688

89+
```
90+
7791
Example 3. /etc/systemd/netlogd.conf
7892

93+
``` sh
94+
7995
[Network]
8096
Address=192.168.8.101:514
8197
#Protocol=udp
8298
LogFormat=rfc5424
8399
StructuredData=[1ab456b6-90bb-6578-abcd-5b734584aaaa@41058]
100+
101+
```
102+
103+
Example 4. /etc/systemd/netlogd.conf
104+
105+
``` sh
106+
107+
[Network]
108+
Address=192.168.8.101:514
109+
#Protocol=udp
110+
LogFormat=rfc5424
111+
UseSysLogStructuredData=yes
112+
UseSysLogMsgId=yes
113+
114+
```
115+
116+
Use case of ```UseSysLogStructuredData=``` and ```UseSysLogMsgId=```
117+
118+
```
119+
sd_journal_send(
120+
"MESSAGE=%s", "Message to process",
121+
"PRIORITY=%s", "4",
122+
"SYSLOG_FACILITY=%s", "1",
123+
"SYSLOG_MSGID=%s", "1011",
124+
"SYSLOG_STRUCTURED_DATA=%s", R"([exampleSDID@32473 iut="3" eventSource="Application"])",
125+
NULL
126+
);
127+
```

0 commit comments

Comments
 (0)