@@ -32,8 +32,16 @@ pub enum Field {
32
32
/// Reserved field that receives special treatment in Datadog.
33
33
Reserved ( String ) ,
34
34
35
- /// A facet -- i.e. started with `@`, transformed to `custom.*`
36
- Facet ( String ) ,
35
+ /// An Attribute-- i.e. started with `@`.
36
+ // In Datadog Log Search the `@` prefix is used to define a Facet for
37
+ // attribute searching, and the event structure is assumed to have a
38
+ // root level field "custom". In VRL we do not guarantee this event
39
+ // structure so we are diverging a little from the DD Log Search
40
+ // definition and implementation a bit here, by calling this "Attribute".
41
+ //
42
+ // Internally when we handle this enum variant, we attempt to parse the
43
+ // string as a log path to obtain the value.
44
+ Attribute ( String ) ,
37
45
38
46
/// Tag type - i.e. search in the `tags` field.
39
47
Tag ( String ) ,
@@ -44,14 +52,14 @@ impl Field {
44
52
match self {
45
53
Self :: Default ( ref s) => s,
46
54
Self :: Reserved ( ref s) => s,
47
- Self :: Facet ( ref s) => s,
55
+ Self :: Attribute ( ref s) => s,
48
56
Self :: Tag ( ref s) => s,
49
57
}
50
58
}
51
59
}
52
60
53
61
/// Converts a field/facet name to the VRL equivalent. Datadog payloads have a `message` field
54
- /// (which is used whenever the default field is encountered. Facets are hosted on .custom.*.
62
+ /// (which is used whenever the default field is encountered.
55
63
pub fn normalize_fields < T : AsRef < str > > ( value : T ) -> Vec < Field > {
56
64
let value = value. as_ref ( ) ;
57
65
if value. eq ( grammar:: DEFAULT_FIELD ) {
@@ -61,8 +69,8 @@ pub fn normalize_fields<T: AsRef<str>>(value: T) -> Vec<Field> {
61
69
. collect ( ) ;
62
70
}
63
71
64
- let field = match value. replace ( '@' , "custom ." ) {
65
- v if value. starts_with ( '@' ) => Field :: Facet ( v) ,
72
+ let field = match value. replace ( '@' , "." ) {
73
+ v if value. starts_with ( '@' ) => Field :: Attribute ( v) ,
66
74
v if DEFAULT_FIELDS . contains ( & v. as_ref ( ) ) => Field :: Default ( v) ,
67
75
v if RESERVED_ATTRIBUTES . contains ( & v. as_ref ( ) ) => Field :: Reserved ( v) ,
68
76
v => Field :: Tag ( v) ,
0 commit comments