Skip to content

Commit

Permalink
fix(socket source): fix socket source ignoring global log_namespace w…
Browse files Browse the repository at this point in the history
…hen computing outputs (#20966)

* fix socket ignoring global log_namespace

* use merge method instead of unwrap_or
  • Loading branch information
Zettroke authored Jul 30, 2024
1 parent 9121a7f commit ecce2ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog.d/socket-not-respecting-global-log-namespace.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The `socket` source now respects global log_namespace setting.

authors: Zettroke
12 changes: 6 additions & 6 deletions src/sources/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ impl SocketConfig {
}
}

fn log_namespace(&self) -> LogNamespace {
fn log_namespace(&self, global_log_namespace: LogNamespace) -> LogNamespace {
match &self.mode {
Mode::Tcp(config) => config.log_namespace.unwrap_or(false).into(),
Mode::Udp(config) => config.log_namespace.unwrap_or(false).into(),
Mode::Tcp(config) => global_log_namespace.merge(config.log_namespace),
Mode::Udp(config) => global_log_namespace.merge(config.log_namespace),
#[cfg(unix)]
Mode::UnixDatagram(config) => config.log_namespace.unwrap_or(false).into(),
Mode::UnixDatagram(config) => global_log_namespace.merge(config.log_namespace),
#[cfg(unix)]
Mode::UnixStream(config) => config.log_namespace.unwrap_or(false).into(),
Mode::UnixStream(config) => global_log_namespace.merge(config.log_namespace),
}
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ impl SourceConfig for SocketConfig {
}

fn outputs(&self, global_log_namespace: LogNamespace) -> Vec<SourceOutput> {
let log_namespace = global_log_namespace.merge(Some(self.log_namespace()));
let log_namespace = self.log_namespace(global_log_namespace);

let schema_definition = self
.decoding()
Expand Down

0 comments on commit ecce2ed

Please sign in to comment.