Geal/rust-syslog

Formatter5424 is not compliant with the RFC

dgouarin opened this issue · 1 comments

When using Formatter5424, a redundant space is added between PRI and VERSION fields.
<134> 1 2021-12-08T10:54:02Z localhost [...]
instead of
<134>1 2021-12-08T10:54:02Z localhost [...]

This makes this formatter unusable with rsyslog's default parser for example.

Attached patch

--- /nfs/thirdparty/rust-vendor/syslog/src/format.rs	2021-12-08 13:58:10.606694317 +0100
+++ syslog/src/format.rs	2021-12-08 12:00:44.361712761 +0100
@@ -114,7 +114,7 @@
   fn format<W: Write>(&self, w: &mut W, severity: Severity, log_message: (i32, StructuredData, T))   -> Result<()> {
     let (message_id, data, message) = log_message;
 
-    write!(w, "<{}> {} {} {} {} {} {} {} {}",
+    write!(w, "<{}>{} {} {} {} {} {} {} {}",
       encode_priority(severity, self.facility),
       1, // version
       time::now_utc().rfc3339(),

oops already fixed, sorry