@@ -7,7 +7,7 @@ use vector_common::internal_event::{
7
7
ByteSize , BytesReceived , InternalEventHandle as _, Protocol , Registered ,
8
8
} ;
9
9
use vector_config:: configurable_component;
10
- use vrl:: event_path ;
10
+ use vrl:: path :: PathPrefix ;
11
11
use vrl:: value:: { kind:: Collection , Kind } ;
12
12
13
13
use super :: util:: framestream:: { build_framestream_unix_source, FrameHandler } ;
@@ -19,9 +19,9 @@ use crate::{
19
19
} ;
20
20
21
21
pub mod parser;
22
- pub use parser:: { parse_dnstap_data, DnstapParser } ;
23
-
24
22
pub mod schema;
23
+ use crate :: sources:: dnstap:: parser:: DnstapParser ;
24
+ use crate :: sources:: dnstap:: schema:: DNSTAP_VALUE_PATHS ;
25
25
use dnsmsg_parser:: { dns_message, dns_message_parser} ;
26
26
use lookup:: lookup_v2:: OptionalValuePath ;
27
27
pub use schema:: DnstapEventSchema ;
@@ -109,19 +109,11 @@ impl DnstapConfig {
109
109
"protobuf:dnstap.Dnstap" . to_string ( ) //content-type for framestream
110
110
}
111
111
112
- fn event_schema ( timestamp_key : Option < & OwnedValuePath > ) -> DnstapEventSchema {
113
- let mut schema = DnstapEventSchema :: new ( ) ;
114
- schema
115
- . dnstap_root_data_schema_mut ( )
116
- . set_timestamp ( timestamp_key. cloned ( ) ) ;
117
- schema
118
- }
119
-
120
112
pub fn schema_definition (
121
113
& self ,
122
114
log_namespace : LogNamespace ,
123
115
) -> vector_core:: schema:: Definition {
124
- let event_schema = Self :: event_schema ( log_schema ( ) . timestamp_key ( ) ) ;
116
+ let event_schema = DnstapEventSchema ;
125
117
126
118
match log_namespace {
127
119
LogNamespace :: Legacy => {
@@ -205,7 +197,6 @@ pub struct DnstapFrameHandler {
205
197
max_frame_length : usize ,
206
198
socket_path : PathBuf ,
207
199
content_type : String ,
208
- schema : DnstapEventSchema ,
209
200
raw_data_only : bool ,
210
201
multithreaded : bool ,
211
202
max_frame_handling_tasks : u32 ,
@@ -224,8 +215,6 @@ impl DnstapFrameHandler {
224
215
let source_type_key = log_schema ( ) . source_type_key ( ) ;
225
216
let timestamp_key = log_schema ( ) . timestamp_key ( ) ;
226
217
227
- let schema = DnstapConfig :: event_schema ( timestamp_key) ;
228
-
229
218
let host_key = config
230
219
. host_key
231
220
. clone ( )
@@ -235,7 +224,6 @@ impl DnstapFrameHandler {
235
224
max_frame_length : config. max_frame_length ,
236
225
socket_path : config. socket_path . clone ( ) ,
237
226
content_type : config. content_type ( ) ,
238
- schema,
239
227
raw_data_only : config. raw_data_only . unwrap_or ( false ) ,
240
228
multithreaded : config. multithreaded . unwrap_or ( false ) ,
241
229
max_frame_handling_tasks : config. max_frame_handling_tasks . unwrap_or ( 1000 ) ,
@@ -281,10 +269,10 @@ impl FrameHandler for DnstapFrameHandler {
281
269
282
270
if self . raw_data_only {
283
271
log_event. insert (
284
- event_path ! ( self . schema . dnstap_root_data_schema ( ) . raw_data( ) ) ,
272
+ ( PathPrefix :: Event , & DNSTAP_VALUE_PATHS . raw_data ) ,
285
273
BASE64_STANDARD . encode ( & frame) ,
286
274
) ;
287
- } else if let Err ( err) = parse_dnstap_data ( & self . schema , & mut log_event, frame) {
275
+ } else if let Err ( err) = DnstapParser :: parse ( & mut log_event, frame) {
288
276
emit ! ( DnstapParseError {
289
277
error: format!( "Dnstap protobuf decode error {:?}." , err)
290
278
} ) ;
@@ -408,7 +396,7 @@ mod tests {
408
396
let mut event = Event :: from ( LogEvent :: from ( vrl:: value:: Value :: from ( json) ) ) ;
409
397
event. as_mut_log ( ) . insert ( "timestamp" , chrono:: Utc :: now ( ) ) ;
410
398
411
- let definition = DnstapConfig :: event_schema ( Some ( & owned_value_path ! ( "timestamp" ) ) ) ;
399
+ let definition = DnstapEventSchema ;
412
400
let schema = vector_core:: schema:: Definition :: empty_legacy_namespace ( )
413
401
. with_standard_vector_source_metadata ( ) ;
414
402
0 commit comments