|
1 | 1 | use bytes::Bytes;
|
2 | 2 | use chrono::{DateTime, NaiveDateTime, Utc};
|
3 | 3 | use derivative::Derivative;
|
4 |
| -use lookup::{event_path, owned_value_path, PathPrefix}; |
| 4 | +use lookup::{event_path, owned_value_path}; |
5 | 5 | use serde::{Deserialize, Serialize};
|
6 | 6 | use smallvec::{smallvec, SmallVec};
|
7 | 7 | use std::collections::HashMap;
|
@@ -130,20 +130,17 @@ impl GelfDeserializer {
|
130 | 130 | log.insert(FULL_MESSAGE, full_message.to_string());
|
131 | 131 | }
|
132 | 132 |
|
133 |
| - if let Some(timestamp_key) = log_schema().timestamp_key() { |
| 133 | + if let Some(timestamp_key) = log_schema().timestamp_key_target_path() { |
134 | 134 | if let Some(timestamp) = parsed.timestamp {
|
135 | 135 | let naive = NaiveDateTime::from_timestamp_opt(
|
136 | 136 | f64::trunc(timestamp) as i64,
|
137 | 137 | f64::fract(timestamp) as u32,
|
138 | 138 | )
|
139 | 139 | .expect("invalid timestamp");
|
140 |
| - log.insert( |
141 |
| - (PathPrefix::Event, timestamp_key), |
142 |
| - DateTime::<Utc>::from_utc(naive, Utc), |
143 |
| - ); |
| 140 | + log.insert(timestamp_key, DateTime::<Utc>::from_utc(naive, Utc)); |
144 | 141 | // per GELF spec- add timestamp if not provided
|
145 | 142 | } else {
|
146 |
| - log.insert((PathPrefix::Event, timestamp_key), Utc::now()); |
| 143 | + log.insert(timestamp_key, Utc::now()); |
147 | 144 | }
|
148 | 145 | }
|
149 | 146 |
|
@@ -293,7 +290,7 @@ mod tests {
|
293 | 290 | Some(&Value::Bytes(Bytes::from_static(b"example.org")))
|
294 | 291 | );
|
295 | 292 | assert_eq!(
|
296 |
| - log.get((PathPrefix::Event, log_schema().message_key().unwrap())), |
| 293 | + log.get(log_schema().message_key_target_path().unwrap()), |
297 | 294 | Some(&Value::Bytes(Bytes::from_static(
|
298 | 295 | b"A short message that helps you identify what is going on"
|
299 | 296 | )))
|
@@ -348,7 +345,7 @@ mod tests {
|
348 | 345 | let events = deserialize_gelf_input(&input).unwrap();
|
349 | 346 | assert_eq!(events.len(), 1);
|
350 | 347 | let log = events[0].as_log();
|
351 |
| - assert!(log.contains((PathPrefix::Event, log_schema().message_key().unwrap()))); |
| 348 | + assert!(log.contains(log_schema().message_key_target_path().unwrap())); |
352 | 349 | }
|
353 | 350 |
|
354 | 351 | // filter out id
|
|
0 commit comments