Skip to content

Commit

Permalink
feat: Refactor dnstap to use 'OwnedValuePath's
Browse files Browse the repository at this point in the history
  • Loading branch information
pront committed Aug 10, 2023
1 parent 7603d28 commit a4e9880
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 995 deletions.
7 changes: 4 additions & 3 deletions src/sources/dnstap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use vector_common::internal_event::{
ByteSize, BytesReceived, InternalEventHandle as _, Protocol, Registered,
};
use vector_config::configurable_component;
use vrl::event_path;
use vrl::path::PathPrefix;
use vrl::value::{kind::Collection, Kind};

use super::util::framestream::{build_framestream_unix_source, FrameHandler};
Expand All @@ -22,6 +22,7 @@ pub mod parser;
pub use parser::{parse_dnstap_data, DnstapParser};

pub mod schema;
use crate::sources::dnstap::schema::DNSTAP_VALUE_PATHS;
use dnsmsg_parser::{dns_message, dns_message_parser};
use lookup::lookup_v2::OptionalValuePath;
pub use schema::DnstapEventSchema;
Expand Down Expand Up @@ -112,7 +113,7 @@ impl DnstapConfig {
fn event_schema(timestamp_key: Option<&OwnedValuePath>) -> DnstapEventSchema {
let mut schema = DnstapEventSchema::new();
schema
.dnstap_root_data_schema_mut()
.dnstap_root_data_schema
.set_timestamp(timestamp_key.cloned());
schema
}
Expand Down Expand Up @@ -281,7 +282,7 @@ impl FrameHandler for DnstapFrameHandler {

if self.raw_data_only {
log_event.insert(
event_path!(self.schema.dnstap_root_data_schema().raw_data()),
(PathPrefix::Event, &DNSTAP_VALUE_PATHS.raw_data),
BASE64_STANDARD.encode(&frame),
);
} else if let Err(err) = parse_dnstap_data(&self.schema, &mut log_event, frame) {
Expand Down
Loading

0 comments on commit a4e9880

Please sign in to comment.