From aca3a296174d38cbe6c4da61e30d8d3033a30060 Mon Sep 17 00:00:00 2001 From: Hugo Hromic Date: Fri, 25 Aug 2023 23:03:56 +0100 Subject: [PATCH] feat(dev): decouple syslog source and codec features (#18381) This commit adds a new `codecs-syslog` feature to Vector mapped to the `codecs/syslog` package feature. This allows for code requiring the `syslog` codec to not depend on the `syslog` source anymore and instead depend on the `syslog` codec directly. For example, it is now possible to compile any source with `syslog` codec support using `codecs-syslog` without having to compile the `syslog` source with it. Signed-off-by: Hugo Hromic --- Cargo.toml | 5 ++++- src/components/validation/resources/mod.rs | 2 +- src/sources/datadog_agent/tests.rs | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e43e2d5866200..002f383b51cf7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -476,6 +476,9 @@ gcp = ["dep:base64", "dep:goauth", "dep:smpl_jwt"] enrichment-tables = ["enrichment-tables-geoip"] enrichment-tables-geoip = ["dep:maxminddb"] +# Codecs +codecs-syslog = ["codecs/syslog"] + # Sources sources = ["sources-logs", "sources-metrics"] sources-logs = [ @@ -559,7 +562,7 @@ sources-socket = ["sources-utils-net", "tokio-util/net"] sources-splunk_hec = ["dep:roaring"] sources-statsd = ["sources-utils-net", "tokio-util/net"] sources-stdin = ["tokio-util/io"] -sources-syslog = ["codecs/syslog", "sources-utils-net", "tokio-util/net"] +sources-syslog = ["codecs-syslog", "sources-utils-net", "tokio-util/net"] sources-utils-http = ["dep:snap", "sources-utils-http-auth", "sources-utils-http-encoding", "sources-utils-http-error", "sources-utils-http-prelude"] sources-utils-http-auth = ["sources-utils-http-error"] sources-utils-http-encoding = ["dep:snap", "sources-utils-http-error"] diff --git a/src/components/validation/resources/mod.rs b/src/components/validation/resources/mod.rs index 3bb2b48697948..105503bf2f4ea 100644 --- a/src/components/validation/resources/mod.rs +++ b/src/components/validation/resources/mod.rs @@ -146,7 +146,7 @@ fn deserializer_config_to_serializer(config: &DeserializerConfig) -> encoding::S // TODO: We need to create an Avro serializer because, certainly, for any source decoding // the data as Avro, we can't possibly send anything else without the source just // immediately barfing. - #[cfg(feature = "sources-syslog")] + #[cfg(feature = "codecs-syslog")] DeserializerConfig::Syslog { .. } => SerializerConfig::Logfmt, DeserializerConfig::Native => SerializerConfig::Native, DeserializerConfig::NativeJson { .. } => SerializerConfig::NativeJson, diff --git a/src/sources/datadog_agent/tests.rs b/src/sources/datadog_agent/tests.rs index 3cc56a038bb36..1b0205d7f8ed2 100644 --- a/src/sources/datadog_agent/tests.rs +++ b/src/sources/datadog_agent/tests.rs @@ -1658,7 +1658,7 @@ fn test_config_outputs() { ]), }, ), - #[cfg(feature = "sources-syslog")] + #[cfg(feature = "codecs-syslog")] ( "syslog / single output", TestCase { @@ -1733,7 +1733,7 @@ fn test_config_outputs() { )]), }, ), - #[cfg(feature = "sources-syslog")] + #[cfg(feature = "codecs-syslog")] ( "syslog / multiple output", TestCase {