Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/codecs/src/decoding/format/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use lookup::OwnedTargetPath;
use serde::{Deserialize, Serialize};
use smallvec::{smallvec, SmallVec};
use vector_core::config::LogNamespace;
use vector_core::schema::meaning;
use vector_core::{
config::{log_schema, DataType},
event::{Event, LogEvent},
Expand Down Expand Up @@ -36,11 +37,17 @@ impl BytesDeserializerConfig {
/// The schema produced by the deserializer.
pub fn schema_definition(&self, log_namespace: LogNamespace) -> schema::Definition {
match log_namespace {
LogNamespace::Legacy => schema::Definition::empty_legacy_namespace().with_event_field(
log_schema().message_key().expect("valid message key"),
Kind::bytes(),
Some("message"),
),
LogNamespace::Legacy => {
let definition = schema::Definition::empty_legacy_namespace();
if let Some(message_key) = log_schema().message_key() {
return definition.with_event_field(
message_key,
Kind::bytes(),
Some(meaning::MESSAGE),
);
}
definition
}
LogNamespace::Vector => {
schema::Definition::new_with_default_metadata(Kind::bytes(), [log_namespace])
.with_meaning(OwnedTargetPath::event_root(), "message")
Expand Down