Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/120547.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 120547
summary: Consistent mapping for OTel log and event bodies
area: Data streams
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,11 @@ template:
properties:
text:
type: match_only_text
flattened:
# this is used for complex bodies of regular log records
structured:
# this is used for complex bodies of log records (including events)
# using the flattened field type avoids mapping issues which can be caused by logs containing arbitrary JSON objects
# the tradeoff is that the flattened field type is currently not supported well by Kibana and has other limitations
type: flattened
structured:
# this is used for events
# events are also represented as log records
# the event.name attribute uniquely identifies event structure / type of the payload (body)
# see also https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/events.md
# this makes them less prone to mapping issues, which is why we're enabling dynamic mappings
type: passthrough
dynamic: true
priority: 10
message:
type: alias
path: body.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Event body:
indices.get_mapping:
index: $datastream-backing-index
- is_true: $datastream-backing-index
- match: { .$datastream-backing-index.mappings.properties.body.properties.structured.properties.foo\.bar.type: "keyword" }
- match: { .$datastream-backing-index.mappings.properties.body.properties.structured.type: "flattened" }
- match: { .$datastream-backing-index.mappings.properties.event_name.type: "keyword" }
---
Structured log body:
Expand All @@ -134,7 +134,7 @@ Structured log body:
attributes:
service.name: my-service
body:
flattened:
structured:
foo:
bar: baz
- is_false: errors
Expand All @@ -146,7 +146,7 @@ Structured log body:
indices.get_mapping:
index: $datastream-backing-index
- is_true: $datastream-backing-index
- match: { .$datastream-backing-index.mappings.properties.body.properties.flattened.type: "flattened" }
- match: { .$datastream-backing-index.mappings.properties.body.properties.structured.type: "flattened" }
---
"event.dataset alias must point to data_stream.dataset":
- do:
Expand Down