From 243f6a9bfd83e698ccceed9e34cda03d4577eb23 Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Tue, 8 Aug 2023 17:29:16 -0400 Subject: [PATCH] feat: disable vrl 'string_path' feature --- Cargo.toml | 4 +++- lib/codecs/src/decoding/format/gelf.rs | 2 +- lib/codecs/src/encoding/format/gelf.rs | 5 ++++- src/api/schema/events/log.rs | 7 ++++--- src/sinks/datadog/events/sink.rs | 14 ++++++------- src/sinks/mezmo.rs | 7 ++++--- src/sinks/sematext/logs.rs | 5 +++-- src/sources/amqp.rs | 15 ++++++-------- src/sources/docker_logs/mod.rs | 27 +++++++++++++------------ src/sources/gcp_pubsub.rs | 9 +++++---- src/sources/nats.rs | 2 +- src/sources/splunk_hec/mod.rs | 10 ++++----- src/sources/syslog.rs | 7 ++++--- src/transforms/lua/v1/mod.rs | 26 +++++++++++++++--------- src/transforms/metric_to_log.rs | 2 +- src/transforms/reduce/merge_strategy.rs | 18 ++++++++++------- src/transforms/remap.rs | 16 +++++++-------- 17 files changed, 98 insertions(+), 78 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 78f416829b22aa..133097928ba836 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -118,7 +118,7 @@ members = [ ] [workspace.dependencies] -vrl = { version = "0.6.0", features = ["cli", "test", "test_framework", "arbitrary"] } +vrl = { version = "0.6.0", default-features = false, features = ["cli", "test", "test_framework", "arbitrary", "compiler", "value", "diagnostic", "path", "parser", "stdlib", "datadog", "core"] } [dependencies] vrl.workspace = true @@ -368,6 +368,8 @@ tokio-test = "0.4.2" tokio = { version = "1.30.0", features = ["test-util"] } tower-test = "0.4.0" vector-core = { path = "lib/vector-core", default-features = false, features = ["vrl", "test"] } +vrl = { version = "0.6.0", features = ["cli", "test", "test_framework", "arbitrary"] } + wiremock = "0.5.19" zstd = { version = "0.12.4", default-features = false } diff --git a/lib/codecs/src/decoding/format/gelf.rs b/lib/codecs/src/decoding/format/gelf.rs index 88d7989c7e2100..77633c328d9d02 100644 --- a/lib/codecs/src/decoding/format/gelf.rs +++ b/lib/codecs/src/decoding/format/gelf.rs @@ -360,7 +360,7 @@ mod tests { let events = deserialize_gelf_input(&input).unwrap(); assert_eq!(events.len(), 1); let log = events[0].as_log(); - assert!(!log.contains("_id")); + assert!(!log.contains(event_path!("_id"))); } } diff --git a/lib/codecs/src/encoding/format/gelf.rs b/lib/codecs/src/encoding/format/gelf.rs index d35bad66decceb..363a377d4c519b 100644 --- a/lib/codecs/src/encoding/format/gelf.rs +++ b/lib/codecs/src/encoding/format/gelf.rs @@ -224,7 +224,10 @@ fn to_gelf_event(log: LogEvent) -> vector_common::Result { coerce_field_names_and_values(log).map(|(mut log, missing_prefix)| { // rename additional fields that were flagged as missing the underscore prefix for field in missing_prefix { - log.rename_key(event_path!(field.as_str()), format!("_{}", &field).as_str()); + log.rename_key( + event_path!(field.as_str()), + event_path!(format!("_{}", &field).as_str()), + ); } log }) diff --git a/src/api/schema/events/log.rs b/src/api/schema/events/log.rs index 251de727c27e7f..ad53474622510e 100644 --- a/src/api/schema/events/log.rs +++ b/src/api/schema/events/log.rs @@ -3,6 +3,7 @@ use std::borrow::Cow; use async_graphql::Object; use chrono::{DateTime, Utc}; use vector_common::encode_logfmt; +use vrl::event_path; use super::EventEncodingType; use crate::{event, topology::TapOutput}; @@ -19,11 +20,11 @@ impl Log { } pub fn get_message(&self) -> Option> { - Some(self.event.get("message")?.to_string_lossy()) + Some(self.event.get(event_path!("message"))?.to_string_lossy()) } pub fn get_timestamp(&self) -> Option<&DateTime> { - self.event.get("timestamp")?.as_timestamp() + self.event.get(event_path!("timestamp"))?.as_timestamp() } } @@ -69,7 +70,7 @@ impl Log { /// Get JSON field data on the log event, by field name async fn json(&self, field: String) -> Option { - self.event.get(field.as_str()).map(|field| { + self.event.get(event_path!(field.as_str())).map(|field| { serde_json::to_string(field) .expect("JSON serialization of trace event field failed. Please report.") }) diff --git a/src/sinks/datadog/events/sink.rs b/src/sinks/datadog/events/sink.rs index 4a7a1a04facd74..a85d23d8290930 100644 --- a/src/sinks/datadog/events/sink.rs +++ b/src/sinks/datadog/events/sink.rs @@ -50,12 +50,12 @@ where async fn ensure_required_fields(event: Event) -> Option { let mut log = event.into_log(); - if !log.contains("title") { + if !log.contains(event_path!("title")) { emit!(ParserMissingFieldError:: { field: "title" }); return None; } - if !log.contains("text") { + if !log.contains(event_path!("text")) { let message_path = log .message_path() .expect("message is required (make sure the \"message\" semantic meaning is set)") @@ -63,21 +63,21 @@ async fn ensure_required_fields(event: Event) -> Option { log.rename_key(&message_path, event_path!("text")); } - if !log.contains("host") { + if !log.contains(event_path!("host")) { if let Some(host_path) = log.host_path().cloned().as_ref() { log.rename_key(host_path, event_path!("host")); } } - if !log.contains("date_happened") { + if !log.contains(event_path!("date_happened")) { if let Some(timestamp_path) = log.timestamp_path().cloned().as_ref() { - log.rename_key(timestamp_path, "date_happened"); + log.rename_key(timestamp_path, event_path!("date_happened")); } } - if !log.contains("source_type_name") { + if !log.contains(event_path!("source_type_name")) { if let Some(source_type_path) = log.source_type_path().cloned().as_ref() { - log.rename_key(source_type_path, "source_type_name"); + log.rename_key(source_type_path, event_path!("source_type_name")); } } diff --git a/src/sinks/mezmo.rs b/src/sinks/mezmo.rs index 97d96f40c8c40a..25999e73163f02 100644 --- a/src/sinks/mezmo.rs +++ b/src/sinks/mezmo.rs @@ -6,6 +6,7 @@ use http::{Request, StatusCode, Uri}; use serde_json::json; use vector_common::sensitive_string::SensitiveString; use vector_config::configurable_component; +use vrl::event_path; use vrl::value::{Kind, Value}; use crate::{ @@ -269,15 +270,15 @@ impl HttpEventEncoder> for map.insert("line".to_string(), json!(line)); map.insert("timestamp".to_string(), json!(timestamp)); - if let Some(env) = log.remove("env") { + if let Some(env) = log.remove(event_path!("env")) { map.insert("env".to_string(), json!(env)); } - if let Some(app) = log.remove("app") { + if let Some(app) = log.remove(event_path!("app")) { map.insert("app".to_string(), json!(app)); } - if let Some(file) = log.remove("file") { + if let Some(file) = log.remove(event_path!("file")) { map.insert("file".to_string(), json!(file)); } diff --git a/src/sinks/sematext/logs.rs b/src/sinks/sematext/logs.rs index e5484b5dbd8591..e5ba64f7e95242 100644 --- a/src/sinks/sematext/logs.rs +++ b/src/sinks/sematext/logs.rs @@ -3,6 +3,7 @@ use futures::stream::{BoxStream, StreamExt}; use indoc::indoc; use vector_common::sensitive_string::SensitiveString; use vector_config::configurable_component; +use vrl::event_path; use super::Region; use crate::{ @@ -144,11 +145,11 @@ fn map_timestamp(mut events: EventArray) -> EventArray { EventArray::Logs(logs) => { for log in logs { if let Some(path) = log.timestamp_path().cloned().as_ref() { - log.rename_key(path, "@timestamp"); + log.rename_key(path, event_path!("@timestamp")); } if let Some(path) = log.host_path().cloned().as_ref() { - log.rename_key(path, "os.host"); + log.rename_key(path, event_path!("os.host")); } } } diff --git a/src/sources/amqp.rs b/src/sources/amqp.rs index f6a9be1a46f092..ca010ff6e911c8 100644 --- a/src/sources/amqp.rs +++ b/src/sources/amqp.rs @@ -20,7 +20,7 @@ use codecs::decoding::{DeserializerConfig, FramingConfig}; use futures::{FutureExt, StreamExt}; use futures_util::Stream; use lapin::{acker::Acker, message::Delivery, Channel}; -use lookup::{lookup_v2::OptionalValuePath, metadata_path, owned_value_path, path, PathPrefix}; +use lookup::{lookup_v2::OptionalValuePath, metadata_path, owned_value_path, path}; use snafu::Snafu; use std::{io::Cursor, pin::Pin}; use tokio_util::codec::FramedRead; @@ -253,7 +253,7 @@ fn populate_event( .path .as_ref() .map(LegacyKey::InsertIfEmpty), - "routing", + path!("routing"), keys.routing.to_string(), ); @@ -264,7 +264,7 @@ fn populate_event( .path .as_ref() .map(LegacyKey::InsertIfEmpty), - "exchange", + path!("exchange"), keys.exchange.to_string(), ); @@ -272,7 +272,7 @@ fn populate_event( AmqpSourceConfig::NAME, log, keys.offset_key.path.as_ref().map(LegacyKey::InsertIfEmpty), - "offset", + path!("offset"), keys.delivery_tag, ); @@ -298,11 +298,8 @@ fn populate_event( log.insert(metadata_path!("vector", "ingest_timestamp"), Utc::now()); } LogNamespace::Legacy => { - if let Some(timestamp_key) = log_schema().timestamp_key() { - log.try_insert( - (PathPrefix::Event, timestamp_key), - timestamp.unwrap_or_else(Utc::now), - ); + if let Some(timestamp_key) = log_schema().timestamp_key_target_path() { + log.try_insert(timestamp_key, timestamp.unwrap_or_else(Utc::now)); } } }; diff --git a/src/sources/docker_logs/mod.rs b/src/sources/docker_logs/mod.rs index bd32dfac4a4312..c597c5ea5574f2 100644 --- a/src/sources/docker_logs/mod.rs +++ b/src/sources/docker_logs/mod.rs @@ -25,6 +25,7 @@ use vector_common::internal_event::{ }; use vector_config::configurable_component; use vector_core::config::{LegacyKey, LogNamespace}; +use vrl::event_path; use vrl::value::{kind::Collection, Kind}; use super::util::MultilineConfig; @@ -1270,21 +1271,24 @@ fn line_agg_adapter( ) -> impl Stream { let line_agg_in = inner.map(move |mut log| { let message_value = match log_namespace { - LogNamespace::Vector => log.remove(".").expect("`.` must exist in the event"), + LogNamespace::Vector => log + .remove(event_path!()) + .expect("`.` must exist in the event"), LogNamespace::Legacy => log - .remove(( - PathPrefix::Event, + .remove( log_schema() - .message_key() + .message_key_target_path() .expect("global log_schema.message_key to be valid path"), - )) + ) .expect("`message` must exist in the event"), }; let stream_value = match log_namespace { LogNamespace::Vector => log .get(metadata_path!(DockerLogsConfig::NAME, STREAM)) .expect("`docker_logs.stream` must exist in the metadata"), - LogNamespace::Legacy => log.get(STREAM).expect("stream must exist in the event"), + LogNamespace::Legacy => log + .get(event_path!(STREAM)) + .expect("stream must exist in the event"), }; let stream = stream_value.coerce_to_bytes(); @@ -1294,14 +1298,11 @@ fn line_agg_adapter( let line_agg_out = LineAgg::<_, Bytes, LogEvent>::new(line_agg_in, logic); line_agg_out.map(move |(_, message, mut log)| { match log_namespace { - LogNamespace::Vector => log.insert(".", message), + LogNamespace::Vector => log.insert(event_path!(), message), LogNamespace::Legacy => log.insert( - ( - PathPrefix::Event, - log_schema() - .message_key() - .expect("global log_schema.message_key to be valid path"), - ), + log_schema() + .message_key_target_path() + .expect("global log_schema.message_key to be valid path"), message, ), }; diff --git a/src/sources/gcp_pubsub.rs b/src/sources/gcp_pubsub.rs index 29128200d9e6b5..d160428b60986a 100644 --- a/src/sources/gcp_pubsub.rs +++ b/src/sources/gcp_pubsub.rs @@ -26,6 +26,7 @@ use vector_common::internal_event::{ use vector_common::{byte_size_of::ByteSizeOf, finalizer::UnorderedFinalizer}; use vector_config::configurable_component; use vector_core::config::{LegacyKey, LogNamespace}; +use vrl::path; use vrl::value::{kind::Collection, Kind}; use crate::{ @@ -687,15 +688,15 @@ impl PubsubSource { log_namespace.insert_source_metadata( PubsubConfig::NAME, log, - Some(LegacyKey::Overwrite("message_id")), - "message_id", + Some(LegacyKey::Overwrite(path!("message_id"))), + path!("message_id"), message.message_id.clone(), ); log_namespace.insert_source_metadata( PubsubConfig::NAME, log, - Some(LegacyKey::Overwrite("attributes")), - "attributes", + Some(LegacyKey::Overwrite(path!("attributes"))), + path!("attributes"), attributes.clone(), ) } diff --git a/src/sources/nats.rs b/src/sources/nats.rs index 2d893a9bee6421..140ef7983bf477 100644 --- a/src/sources/nats.rs +++ b/src/sources/nats.rs @@ -232,7 +232,7 @@ async fn nats_source( NatsSourceConfig::NAME, log, legacy_subject_key_field, - "subject", + &owned_value_path!("subject"), msg.subject.as_str(), ) } diff --git a/src/sources/splunk_hec/mod.rs b/src/sources/splunk_hec/mod.rs index 78deae6cc60fcd..e704a2e31cc497 100644 --- a/src/sources/splunk_hec/mod.rs +++ b/src/sources/splunk_hec/mod.rs @@ -676,7 +676,7 @@ impl<'de, R: JsonRead<'de>> EventIterator<'de, R> { self.log_namespace.insert_vector_metadata( &mut log, log_schema().source_type_key(), - lookup::path!("source_type"), + &owned_value_path!("source_type"), SplunkConfig::NAME, ); @@ -685,7 +685,7 @@ impl<'de, R: JsonRead<'de>> EventIterator<'de, R> { self.log_namespace.insert_source_metadata( SplunkConfig::NAME, &mut log, - Some(LegacyKey::Overwrite(CHANNEL)), + Some(LegacyKey::Overwrite(&owned_value_path!(CHANNEL))), CHANNEL, guid, ); @@ -693,7 +693,7 @@ impl<'de, R: JsonRead<'de>> EventIterator<'de, R> { self.log_namespace.insert_source_metadata( SplunkConfig::NAME, &mut log, - Some(LegacyKey::Overwrite(CHANNEL)), + Some(LegacyKey::Overwrite(&owned_value_path!(CHANNEL))), CHANNEL, guid.clone(), ); @@ -705,7 +705,7 @@ impl<'de, R: JsonRead<'de>> EventIterator<'de, R> { self.log_namespace.insert_source_metadata( SplunkConfig::NAME, &mut log, - Some(LegacyKey::Overwrite(key.as_str())), + Some(LegacyKey::Overwrite(&owned_value_path!(key.as_str()))), key.as_str(), value, ); @@ -1009,7 +1009,7 @@ fn raw_event( log_namespace.insert_source_metadata( SplunkConfig::NAME, &mut log, - Some(LegacyKey::Overwrite(CHANNEL)), + Some(LegacyKey::Overwrite(&owned_value_path!(CHANNEL))), CHANNEL, channel, ); diff --git a/src/sources/syslog.rs b/src/sources/syslog.rs index c674939daef230..1418d77730d6fb 100644 --- a/src/sources/syslog.rs +++ b/src/sources/syslog.rs @@ -15,6 +15,7 @@ use smallvec::SmallVec; use tokio_util::udp::UdpFramed; use vector_config::configurable_component; use vector_core::config::{LegacyKey, LogNamespace}; +use vrl::event_path; #[cfg(unix)] use crate::sources::util::build_unix_stream_source; @@ -394,14 +395,14 @@ fn enrich_syslog_event( log_namespace.insert_source_metadata( SyslogConfig::NAME, log, - Some(LegacyKey::Overwrite("source_ip")), + Some(LegacyKey::Overwrite(path!("source_ip"))), path!("source_ip"), default_host.clone(), ); } let parsed_hostname = log - .get("hostname") + .get(event_path!("hostname")) .map(|hostname| hostname.coerce_to_bytes()); if let Some(parsed_host) = parsed_hostname.or(default_host) { @@ -420,7 +421,7 @@ fn enrich_syslog_event( if log_namespace == LogNamespace::Legacy { let timestamp = log - .get("timestamp") + .get(event_path!("timestamp")) .and_then(|timestamp| timestamp.as_timestamp().cloned()) .unwrap_or_else(Utc::now); log.maybe_insert(log_schema().timestamp_key_target_path(), timestamp); diff --git a/src/transforms/lua/v1/mod.rs b/src/transforms/lua/v1/mod.rs index f5b143214141be..58a94f939261da 100644 --- a/src/transforms/lua/v1/mod.rs +++ b/src/transforms/lua/v1/mod.rs @@ -1,9 +1,11 @@ use std::{future::ready, pin::Pin}; use futures::{stream, Stream, StreamExt}; +use mlua::ExternalError; use ordered_float::NotNan; use snafu::{ResultExt, Snafu}; use vector_config::configurable_component; +use vrl::path::parse_target_path; use crate::config::OutputId; use crate::schema::Definition; @@ -223,6 +225,7 @@ impl mlua::UserData for LuaEvent { methods.add_meta_method_mut( mlua::MetaMethod::NewIndex, |_lua, this, (key, value): (String, Option>)| { + let key_path = parse_target_path(key.as_str()).map_err(|e| e.to_lua_err())?; match value { Some(mlua::Value::String(string)) => { this.inner.as_mut_log().insert( @@ -233,20 +236,20 @@ impl mlua::UserData for LuaEvent { Some(mlua::Value::Integer(integer)) => { this.inner .as_mut_log() - .insert(key.as_str(), Value::Integer(integer)); + .insert(&key_path, Value::Integer(integer)); } Some(mlua::Value::Number(number)) if !number.is_nan() => { this.inner .as_mut_log() - .insert(key.as_str(), Value::Float(NotNan::new(number).unwrap())); + .insert(&key_path, Value::Float(NotNan::new(number).unwrap())); } Some(mlua::Value::Boolean(boolean)) => { this.inner .as_mut_log() - .insert(key.as_str(), Value::Boolean(boolean)); + .insert(&key_path, Value::Boolean(boolean)); } Some(mlua::Value::Nil) | None => { - this.inner.as_mut_log().remove(key.as_str()); + this.inner.as_mut_log().remove(&key_path); } _ => { info!( @@ -255,7 +258,7 @@ impl mlua::UserData for LuaEvent { field = key.as_str(), internal_log_rate_limit = true ); - this.inner.as_mut_log().remove(key.as_str()); + this.inner.as_mut_log().remove(&key_path); } } @@ -287,10 +290,15 @@ impl mlua::UserData for LuaEvent { let keys: mlua::Table = state.raw_get("keys")?; let next: mlua::Function = lua.globals().raw_get("next")?; let key: Option = next.call((keys, prev))?; - match key - .clone() - .and_then(|k| event.inner.as_log().get(k.as_str())) - { + let value = key.clone().and_then(|k| { + event + .inner + .as_log() + .parse_path_and_get_value(k.as_str()) + .ok() + .flatten() + }); + match value { Some(value) => { Ok((key, Some(lua.create_string(&value.coerce_to_bytes())?))) } diff --git a/src/transforms/metric_to_log.rs b/src/transforms/metric_to_log.rs index ed6b6d8c8abcd5..f2abf8e2111567 100644 --- a/src/transforms/metric_to_log.rs +++ b/src/transforms/metric_to_log.rs @@ -313,7 +313,7 @@ impl MetricToLog { if let Some(host_tag) = &self.host_tag { if let Some(host_value) = - log.remove_prune(host_tag.to_string().as_str(), true) + log.remove_prune((PathPrefix::Event, host_tag), true) { log.maybe_insert(log_schema().host_key_target_path(), host_value); } diff --git a/src/transforms/reduce/merge_strategy.rs b/src/transforms/reduce/merge_strategy.rs index 7cb954fa91e78a..beef0558c1e3bf 100644 --- a/src/transforms/reduce/merge_strategy.rs +++ b/src/transforms/reduce/merge_strategy.rs @@ -4,6 +4,7 @@ use bytes::{Bytes, BytesMut}; use chrono::{DateTime, Utc}; use ordered_float::NotNan; use vector_config::configurable_component; +use vrl::event_path; use crate::event::{LogEvent, Value}; @@ -68,7 +69,7 @@ impl ReduceValueMerger for DiscardMerger { } fn insert_into(self: Box, k: String, v: &mut LogEvent) -> Result<(), String> { - v.insert(k.as_str(), self.v); + v.insert(event_path!(k.as_str()), self.v); Ok(()) } } @@ -327,8 +328,11 @@ impl ReduceValueMerger for TimestampWindowMerger { } fn insert_into(self: Box, k: String, v: &mut LogEvent) -> Result<(), String> { - v.insert(format!("{}_end", k).as_str(), Value::Timestamp(self.latest)); - v.insert(k.as_str(), Value::Timestamp(self.started)); + v.insert( + event_path!(format!("{}_end", k).as_str()), + Value::Timestamp(self.latest), + ); + v.insert(event_path!(k.as_str()), Value::Timestamp(self.started)); Ok(()) } } @@ -448,8 +452,8 @@ impl ReduceValueMerger for MaxNumberMerger { fn insert_into(self: Box, k: String, v: &mut LogEvent) -> Result<(), String> { match self.v { - NumberMergerValue::Float(f) => v.insert(k.as_str(), Value::Float(f)), - NumberMergerValue::Int(i) => v.insert(k.as_str(), Value::Integer(i)), + NumberMergerValue::Float(f) => v.insert(event_path!(k.as_str()), Value::Float(f)), + NumberMergerValue::Int(i) => v.insert(event_path!(k.as_str()), Value::Integer(i)), }; Ok(()) } @@ -507,8 +511,8 @@ impl ReduceValueMerger for MinNumberMerger { fn insert_into(self: Box, k: String, v: &mut LogEvent) -> Result<(), String> { match self.v { - NumberMergerValue::Float(f) => v.insert(k.as_str(), Value::Float(f)), - NumberMergerValue::Int(i) => v.insert(k.as_str(), Value::Integer(i)), + NumberMergerValue::Float(f) => v.insert(event_path!(k.as_str()), Value::Float(f)), + NumberMergerValue::Int(i) => v.insert(event_path!(k.as_str()), Value::Integer(i)), }; Ok(()) } diff --git a/src/transforms/remap.rs b/src/transforms/remap.rs index 50b01d4d6783ba..94aa823d96463b 100644 --- a/src/transforms/remap.rs +++ b/src/transforms/remap.rs @@ -609,8 +609,8 @@ mod tests { use indoc::{formatdoc, indoc}; use vector_core::{config::GlobalOptions, event::EventMetadata, metric_tags}; - use vrl::btreemap; use vrl::value::kind::Collection; + use vrl::{btreemap, event_path}; use super::*; use crate::{ @@ -1174,12 +1174,12 @@ mod tests { let log = output.as_log(); assert_eq!(log["hello"], "world".into()); assert_eq!(log["foo"], "bar".into()); - assert!(!log.contains("metadata")); + assert!(!log.contains(event_path!("metadata"))); let output = transform_one_fallible(&mut tform, abort).unwrap_err(); let log = output.as_log(); assert_eq!(log["hello"], "goodbye".into()); - assert!(!log.contains("foo")); + assert!(!log.contains(event_path!("foo"))); assert_eq!( log["metadata"], serde_json::json!({ @@ -1198,7 +1198,7 @@ mod tests { let output = transform_one_fallible(&mut tform, error).unwrap_err(); let log = output.as_log(); assert_eq!(log["hello"], 42.into()); - assert!(!log.contains("foo")); + assert!(!log.contains(event_path!("foo"))); assert_eq!( log["metadata"], serde_json::json!({ @@ -1310,7 +1310,7 @@ mod tests { transform_one_fallible(&mut tform, error_trigger_assert_custom_message).unwrap_err(); let log = output.as_log(); assert_eq!(log["hello"], 42.into()); - assert!(!log.contains("foo")); + assert!(!log.contains(event_path!("foo"))); assert_eq!( log["metadata"], serde_json::json!({ @@ -1330,7 +1330,7 @@ mod tests { transform_one_fallible(&mut tform, error_trigger_default_assert_message).unwrap_err(); let log = output.as_log(); assert_eq!(log["hello"], 0.into()); - assert!(!log.contains("foo")); + assert!(!log.contains(event_path!("foo"))); assert_eq!( log["metadata"], serde_json::json!({ @@ -1368,7 +1368,7 @@ mod tests { let output = transform_one_fallible(&mut tform, error).unwrap_err(); let log = output.as_log(); assert_eq!(log["hello"], 42.into()); - assert!(!log.contains("foo")); + assert!(!log.contains(event_path!("foo"))); assert_eq!( log["metadata"], serde_json::json!({ @@ -1448,7 +1448,7 @@ mod tests { let log = output.as_log(); assert_eq!(log["hello"], "world".into()); assert_eq!(log["foo"], "bar".into()); - assert!(!log.contains("metadata")); + assert!(!log.contains(event_path!("metadata"))); let out = collect_outputs(&mut tform, abort); assert!(out.primary.is_empty());