From b009e4d72c7cf0864e5cd5dcb6a392e6559db786 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Mon, 31 Jul 2023 17:17:17 +0100 Subject: [PATCH] chore(codecs): Update syslog_loose to properly handle escapes (#18114) * Update syslog_loose to properly handle escapes Signed-off-by: Stephen Wakely * fmt Signed-off-by: Stephen Wakely --------- Signed-off-by: Stephen Wakely --- Cargo.lock | 14 ++++++++++++-- lib/codecs/Cargo.toml | 2 +- lib/codecs/src/decoding/format/syslog.rs | 5 +++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a5f635dafc5cf..1450b586f82cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1975,7 +1975,7 @@ dependencies = [ "similar-asserts", "smallvec", "snafu", - "syslog_loose", + "syslog_loose 0.19.0", "tokio", "tokio-util", "tracing 0.1.37", @@ -8136,6 +8136,16 @@ dependencies = [ "nom", ] +[[package]] +name = "syslog_loose" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acf5252d1adec0a489a0225f867c1a7fd445e41674530a396d0629cff0c4b211" +dependencies = [ + "chrono", + "nom", +] + [[package]] name = "take_mut" version = "0.2.2" @@ -9830,7 +9840,7 @@ dependencies = [ "sha3", "snafu", "strip-ansi-escapes", - "syslog_loose", + "syslog_loose 0.18.0", "termcolor", "thiserror", "tracing 0.1.37", diff --git a/lib/codecs/Cargo.toml b/lib/codecs/Cargo.toml index b987532c441dd..31d4e615ec96d 100644 --- a/lib/codecs/Cargo.toml +++ b/lib/codecs/Cargo.toml @@ -23,7 +23,7 @@ serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false } smallvec = { version = "1", default-features = false, features = ["union"] } snafu = { version = "0.7.5", default-features = false, features = ["futures"] } -syslog_loose = { version = "0.18", default-features = false, optional = true } +syslog_loose = { version = "0.19", default-features = false, optional = true } tokio-util = { version = "0.7", default-features = false, features = ["codec"] } tracing = { version = "0.1", default-features = false } vrl.workspace = true diff --git a/lib/codecs/src/decoding/format/syslog.rs b/lib/codecs/src/decoding/format/syslog.rs index a7ab83aebbbaa..041d6a4c93cc6 100644 --- a/lib/codecs/src/decoding/format/syslog.rs +++ b/lib/codecs/src/decoding/format/syslog.rs @@ -5,7 +5,7 @@ use lookup::{event_path, owned_value_path, OwnedTargetPath, OwnedValuePath}; use smallvec::{smallvec, SmallVec}; use std::borrow::Cow; use std::collections::BTreeMap; -use syslog_loose::{IncompleteDate, Message, ProcId, Protocol}; +use syslog_loose::{IncompleteDate, Message, ProcId, Protocol, Variant}; use vector_config::configurable_component; use vector_core::config::{LegacyKey, LogNamespace}; use vector_core::{ @@ -282,7 +282,8 @@ impl Deserializer for SyslogDeserializer { false => Cow::from(std::str::from_utf8(&bytes)?), }; let line = line.trim(); - let parsed = syslog_loose::parse_message_with_year_exact(line, resolve_year)?; + let parsed = + syslog_loose::parse_message_with_year_exact(line, resolve_year, Variant::Either)?; let log = match (self.source, log_namespace) { (Some(source), LogNamespace::Vector) => {