You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[exporter/elasticsearch] Support preserving attributes when mapping to ECS (#33670)
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
This PR adds support for preserving resource attributes that are valid
ECS fields in addition of mapping them. At the moment the `host.name` is
mapped to the `host.hostname`. Both are valid ECS fields but can differ
in some cases. Since there is no such distinction in SemConv right now,
it does makes sense to preserve both.
refs:
-
https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-name
-
https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-hostname
**Link to tracking Issue:** <Issue number if applicable>
**Testing:** <Describe what testing was performed and which tests were
added.>
Using the testing notes from
#33622.
Stored document:
```json
{
"app": {
"label": {
"component": "migration-logger"
}
},
"kubernetes": {
"node": {
"name": "kind-control-plane"
},
"pod": {
"uid": "0eda57cd-a4ae-4e89-88fa-c771d3bf0c77",
"name": "daemonset-logs-4sqjq"
},
"namespace": "default"
},
"agent": {
"name": "otlp"
},
"@timestamp": "2024-06-20T07:27:42.589678923Z",
"log": {
"iostream": "stdout",
"file": {
"path": "/var/log/pods/default_daemonset-logs-4sqjq_0eda57cd-a4ae-4e89-88fa-c771d3bf0c77/busybox/0.log"
}
},
"service": {
"name": "migration-logger"
},
"k8s": {
"container": {
"restart_count": "0",
"name": "busybox"
},
"pod": {
"start_time": "2024-06-20T07:27:21Z"
},
"daemonset": {
"name": "daemonset-logs"
}
},
"host": {
"hostname": "daemonset-opentelemetry-collector-agent-l6pzp",
"os": {
"type": "linux",
"platform": "linux"
},
"name": "daemonset-opentelemetry-collector-agent-l6pzp"
},
"time": "2024-06-20T07:27:42.589678923Z",
"message": "otel logs at 07:27:42",
"logtag": "F"
}
```
**Documentation:** <Describe the documentation added.> ~
/cc @lahsivjar@andrzej-stencel@carsonip
---------
Signed-off-by: ChrsMark <[email protected]>
want:=`{"@timestamp":"2024-03-12T20:00:41.123456789Z","agent":{"name":"otlp"},"container":{"image":{"tag":["v3.4.0"]}},"event":{"action":"user-password-change"},"host":{"hostname":"localhost","os":{"full":"Mac OS Mojave","name":"Mac OS X","platform":"darwin","type":"macos","version":"10.14.1"}},"service":{"name":"foo.bar","version":"1.1.0"}}`
234
+
want:=`{"@timestamp":"2024-03-12T20:00:41.123456789Z","agent":{"name":"otlp"},"container":{"image":{"tag":["v3.4.0"]}},"event":{"action":"user-password-change"},"host":{"hostname":"localhost","name":"localhost","os":{"full":"Mac OS Mojave","name":"Mac OS X","platform":"darwin","type":"macos","version":"10.14.1"}},"service":{"name":"foo.bar","version":"1.1.0"}}`
0 commit comments