Skip to content

Commit

Permalink
feat(dev): decouple syslog source and codec features (vectordotdev#18381
Browse files Browse the repository at this point in the history
)

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 <hhromic@gmail.com>
  • Loading branch information
hhromic committed Aug 25, 2023
1 parent 2a4235c commit aca3a29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion src/components/validation/resources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/sources/datadog_agent/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ fn test_config_outputs() {
]),
},
),
#[cfg(feature = "sources-syslog")]
#[cfg(feature = "codecs-syslog")]
(
"syslog / single output",
TestCase {
Expand Down Expand Up @@ -1733,7 +1733,7 @@ fn test_config_outputs() {
)]),
},
),
#[cfg(feature = "sources-syslog")]
#[cfg(feature = "codecs-syslog")]
(
"syslog / multiple output",
TestCase {
Expand Down

0 comments on commit aca3a29

Please sign in to comment.