Skip to content

Commit fe49dd9

Browse files
committed
Fix RFC 3339 vs RFC 3164 mixup for message format
The message format was incorrectly referred to as RFC 3339 (a date/time format) throughout the codebase, when it should be RFC 3164 (the BSD syslog protocol). The timestamp formatting function format_rfc3339_timestamp() is left unchanged as it correctly formats timestamps per RFC 3339. Fixes: #144
1 parent eac4fc6 commit fe49dd9

16 files changed

Lines changed: 31 additions & 29 deletions

ARCHITECTURE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ systemd-netlogd is a network logging daemon that reads from the systemd journal
4747
│ │ │
4848
│ ├──────► Protocol Layer │
4949
│ │ ├─► RFC 5424 Formatter │
50-
│ │ ├─► RFC 3339 Formatter │
50+
│ │ ├─► RFC 3164 Formatter │
5151
│ │ └─► RFC 5425 Formatter │
5252
│ │ │
5353
│ └──────► Transport Layer │
@@ -77,8 +77,8 @@ systemd-netlogd is a network logging daemon that reads from the systemd journal
7777
│ └─► Extract timestamp
7878
7979
├─► manager_push_to_network()
80-
│ ├─► Select formatter (RFC 5424/3339)
81-
│ ├─► format_rfc5424() or format_rfc3339()
80+
│ ├─► Select formatter (RFC 5424/3164)
81+
│ ├─► format_rfc5424() or format_rfc3164()
8282
│ │ ├─► Build priority field: <PRI> = (facility * 8) + severity
8383
│ │ ├─► Format timestamp (RFC 3339)
8484
│ │ ├─► Add hostname, identifier, pid
@@ -198,7 +198,7 @@ Example:
198198
<34>1 2024-01-20T10:30:15.123456+00:00 hostname myapp 1234 LOGIN001 [auth@12345] User logged in
199199
```
200200

201-
**RFC 3339 Format (Legacy):**
201+
**RFC 3164 Format (Legacy):**
202202
```
203203
<PRI>TIMESTAMP HOSTNAME APP-NAME[PROCID]: MSG
204204
```
@@ -489,6 +489,7 @@ Facilities that may contain credentials:
489489

490490
- [RFC 5424](https://tools.ietf.org/html/rfc5424) - The Syslog Protocol
491491
- [RFC 5425](https://tools.ietf.org/html/rfc5425) - Transport Layer Security (TLS) Transport Mapping for Syslog
492+
- [RFC 3164](https://tools.ietf.org/html/rfc3164) - The BSD Syslog Protocol
492493
- [RFC 3339](https://tools.ietf.org/html/rfc3339) - Date and Time on the Internet: Timestamps
493494
- [RFC 6012](https://tools.ietf.org/html/rfc6012) - Datagram Transport Layer Security (DTLS) Transport Mapping for Syslog
494495
- [systemd Journal](https://www.freedesktop.org/software/systemd/man/sd-journal.html)

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7373
### Added
7474
- Initial release
7575
- UDP transport for syslog messages
76-
- RFC 3339 timestamp format
76+
- RFC 3164 message format
7777
- systemd journal integration
7878
- Multicast support
7979

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ int main(void) {
267267
Aim for:
268268
- All new functions should have tests
269269
- Edge cases and error conditions
270-
- Protocol compliance (RFC 5424, RFC 3339)
270+
- Protocol compliance (RFC 5424, RFC 3164)
271271
272272
## Submitting Changes
273273
@@ -418,7 +418,7 @@ perf report
418418

419419
- [systemd Coding Style](https://systemd.io/CODING_STYLE/)
420420
- [RFC 5424](https://tools.ietf.org/html/rfc5424) - Syslog Protocol
421-
- [RFC 3339](https://tools.ietf.org/html/rfc3339) - Date and Time on the Internet
421+
- [RFC 3164](https://tools.ietf.org/html/rfc3164) - The BSD Syslog Protocol
422422
- [systemd Journal API](https://www.freedesktop.org/software/systemd/man/sd-journal.html)
423423

424424
## Getting Help

FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ TLSServerCertificate=/path/to/self-signed-cert.pem
184184

185185
## Log Formats
186186

187-
### What's the difference between RFC 5424 and RFC 3339?
187+
### What's the difference between RFC 5424 and RFC 3164?
188188

189189
**RFC 5424** (recommended):
190190
```
@@ -194,7 +194,7 @@ TLSServerCertificate=/path/to/self-signed-cert.pem
194194
- Structured data support
195195
- Modern syslog standard
196196

197-
**RFC 3339** (legacy):
197+
**RFC 3164** (legacy):
198198
```
199199
<34>2024-01-20T10:30:15.123456+00:00 hostname myapp[1234]: User logged in
200200
```

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ journalctl -u systemd-netlogd -f
7575
- **🌐 Network-Aware**: Automatically detects network state changes via `sd-network`
7676
- **⚡ Zero Buffering**: Sequential journal reading without local caching
7777
- **🔒 Secure Transport**: UDP, TCP, TLS (RFC 5425), DTLS (RFC 6012)
78-
- **📋 Standard Formats**: RFC 5424 (recommended), RFC 3339 (legacy BSD syslog)
78+
- **📋 Standard Formats**: RFC 5424 (recommended), RFC 3164 (legacy BSD syslog)
7979
- **🎯 Smart Filtering**: Exclude sensitive facilities (auth/authpriv) and log levels
8080
- **📦 Namespace Support**: Forward from specific namespaces or aggregate all
8181
- **🛡️ Hardened**: Runs as unprivileged `systemd-journal-netlog` user with restricted capabilities
@@ -164,7 +164,7 @@ sudo systemctl enable --now systemd-netlogd
164164
|--------|-------------|---------|
165165
| **`Address=`** | Destination server (IP:port or multicast) | *Required* |
166166
| **`Protocol=`** | Transport: `udp`, `tcp`, `tls`, `dtls` | `udp` |
167-
| **`LogFormat=`** | Format: `rfc5424`, `rfc5425`, `rfc3339` | `rfc5424` |
167+
| **`LogFormat=`** | Format: `rfc5424`, `rfc5425`, `rfc3164` | `rfc5424` |
168168
| `ConnectionRetrySec=` | Retry interval on failure | `30s` |
169169
| `TLSCertificateAuthMode=` | TLS validation: `deny`, `warn`, `allow`, `no` | `deny` |
170170
| `TLSServerCertificate=` | Path to CA certificate PEM file | System CA |
@@ -178,7 +178,7 @@ sudo systemctl enable --now systemd-netlogd
178178
|--------|-------------|---------|
179179
| `Address=` | Destination (IP:port or multicast group) | **Required** |
180180
| `Protocol=` | `udp`, `tcp`, `tls`, `dtls` | `udp` |
181-
| `LogFormat=` | `rfc5424`, `rfc5425` (TLS), `rfc3339` (legacy) | `rfc5424` |
181+
| `LogFormat=` | `rfc5424`, `rfc5425` (TLS), `rfc3164` (legacy) | `rfc5424` |
182182
| `Directory=` | Custom journal directory path | System default |
183183
| `Namespace=` | Journal namespace: `*` (all), `+id` (id+default), `id` | Default |
184184
| `ConnectionRetrySec=` | Reconnect delay after failure | `30s` |

TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Tests RFC 3339 timestamp formatting:
4343
#### test-string-tables
4444
Tests string table conversions:
4545
- Protocol names (udp, tcp, tls, dtls)
46-
- Log formats (rfc5424, rfc3339, rfc5425)
46+
- Log formats (rfc5424, rfc3164, rfc5425)
4747
- Syslog facilities (kern, user, mail, etc.)
4848
- Syslog levels (emerg, alert, crit, etc.)
4949

doc/index.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Synopsis
2323
Description
2424
-----------
2525

26-
**systemd-netlogd** is a lightweight, network-aware daemon for forwarding log messages from the **systemd journal** to remote hosts over the network using the **Syslog protocol** (RFC 5424 and RFC 3339). It supports unicast and multicast destinations, ensuring efficient log aggregation in distributed environments.
26+
**systemd-netlogd** is a lightweight, network-aware daemon for forwarding log messages from the **systemd journal** to remote hosts over the network using the **Syslog protocol** (RFC 5424 and RFC 3164). It supports unicast and multicast destinations, ensuring efficient log aggregation in distributed environments.
2727

2828
Key features:
2929

3030
- **Efficient forwarding**: Reads journal entries sequentially and transmits them one-by-one without buffering or additional disk usage.
3131
- **Network integration**: Leverages ``sd-network`` to start forwarding when the network is up and pause when it's down.
3232
- **Secure transports**: Supports UDP (default), TCP, TLS, and DTLS (RFC 6012 for datagram security).
33-
- **Flexible output**: Formats logs as RFC 5424 (default), RFC 5425 (length-prefixed for TLS), or RFC 3339.
33+
- **Flexible output**: Formats logs as RFC 5424 (default), RFC 5425 (length-prefixed for TLS), or RFC 3164.
3434
- **Isolation**: Runs as the dedicated system user ``systemd-journal-netlog`` with minimal privileges.
3535
- **Filtering**: Exclude specific syslog facilities or levels; target specific journal namespaces.
3636
- **Fault tolerant**: Automatic reconnection with cursor persistence ensures no message loss.
@@ -113,7 +113,7 @@ Option Type Default Description
113113
============================ ====== ============ ================================================================================================
114114
``Address=`` string *(required)* Destination (unicast ``IP:PORT`` or multicast ``GROUP:PORT``). See :manpage:`systemd.socket(5)`.
115115
``Protocol=`` enum ``udp`` Transport protocol: ``udp``, ``tcp``, ``tls``, ``dtls``.
116-
``LogFormat=`` enum ``rfc5424`` Message format: ``rfc5424`` (recommended), ``rfc5425`` (length-prefixed for TLS), ``rfc3339`` (legacy BSD syslog).
116+
``LogFormat=`` enum ``rfc5424`` Message format: ``rfc5424`` (recommended), ``rfc5425`` (length-prefixed for TLS), ``rfc3164`` (legacy BSD syslog).
117117
``Directory=`` path *system* Custom journal directory. Mutually exclusive with ``Namespace=``.
118118
``Namespace=`` string *default* Journal namespace filter: specific ID, ``*`` (all namespaces), or ``+ID`` (ID plus default namespace).
119119
``ConnectionRetrySec=`` time ``30s`` Reconnect delay after connection failure (minimum 1s). See :manpage:`systemd.time(5)`.
@@ -147,14 +147,14 @@ UDP Multicast
147147
[Network]
148148
Address=239.0.0.1:6000
149149
150-
Unicast UDP (RFC 3339)
150+
Unicast UDP (RFC 3164)
151151
^^^^^^^^^^^^^^^^^^^^^^
152152

153153
.. code-block:: ini
154154
155155
[Network]
156156
Address=192.168.8.101:514
157-
LogFormat=rfc3339
157+
LogFormat=rfc3164
158158
159159
Custom Structured Data
160160
^^^^^^^^^^^^^^^^^^^^^^
@@ -717,6 +717,7 @@ See Also
717717
**RFCs and Standards:**
718718
- `RFC 5424 <https://tools.ietf.org/html/rfc5424>`_ - The Syslog Protocol
719719
- `RFC 5425 <https://tools.ietf.org/html/rfc5425>`_ - Transport Layer Security (TLS) Transport Mapping for Syslog
720+
- `RFC 3164 <https://tools.ietf.org/html/rfc3164>`_ - The BSD Syslog Protocol
720721
- `RFC 3339 <https://tools.ietf.org/html/rfc3339>`_ - Date and Time on the Internet: Timestamps
721722
- `RFC 6012 <https://tools.ietf.org/html/rfc6012>`_ - Datagram Transport Layer Security (DTLS) Transport Mapping for Syslog
722723

examples/development.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Address=127.0.0.1:514
77
Protocol=udp
88

99
# Use legacy format for easier reading
10-
LogFormat=rfc3339
10+
LogFormat=rfc3164
1111

1212
# Fast retry for development iteration
1313
ConnectionRetrySec=5

src/netlog/netlog-manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DEFINE_STRING_TABLE_LOOKUP(protocol, SysLogTransmissionProtocol);
3030
static const char *const log_format_table[_SYSLOG_TRANSMISSION_LOG_FORMAT_MAX] = {
3131
[SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_5424] = "rfc5424",
3232
[SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_5425] = "rfc5425",
33-
[SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_3339] = "rfc3339",
33+
[SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_3164] = "rfc3164",
3434
};
3535

3636
DEFINE_STRING_TABLE_LOOKUP(log_format, SysLogTransmissionLogFormat);

src/netlog/netlog-manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef enum SysLogTransmissionProtocol {
2424

2525
typedef enum SysLogTransmissionLogFormat {
2626
SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_5424 = 1 << 0,
27-
SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_3339 = 1 << 1,
27+
SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_3164 = 1 << 1,
2828
SYSLOG_TRANSMISSION_LOG_FORMAT_RFC_5425 = 1 << 2,
2929
_SYSLOG_TRANSMISSION_LOG_FORMAT_MAX,
3030
_SYSLOG_TRANSMISSION_LOG_FORMAT_INVALID = -EINVAL,

0 commit comments

Comments
 (0)