Skip to content

Commit

Permalink
[otel-data] Add more kubernetes aliases (elastic#115429)
Browse files Browse the repository at this point in the history
* Add more kubernetes aliases

* Update docs/changelog/115429.yaml

* Review feedback

---------

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
gregkalapos and elasticmachine authored Oct 24, 2024
1 parent 28882e8 commit 37c7137
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/115429.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 115429
summary: "[otel-data] Add more kubernetes aliases"
area: Data streams
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,45 @@ template:
os.version:
type: keyword
ignore_above: 1024
k8s.container.name:
type: keyword
ignore_above: 1024
k8s.cronjob.name:
type: keyword
ignore_above: 1024
k8s.daemonset.name:
type: keyword
ignore_above: 1024
k8s.deployment.name:
type: keyword
ignore_above: 1024
k8s.job.name:
type: keyword
ignore_above: 1024
k8s.namespace.name:
type: keyword
ignore_above: 1024
k8s.node.hostname:
type: keyword
ignore_above: 1024
k8s.node.name:
type: keyword
ignore_above: 1024
k8s.node.uid:
type: keyword
ignore_above: 1024
k8s.pod.name:
type: keyword
ignore_above: 1024
k8s.pod.uid:
type: keyword
ignore_above: 1024
k8s.replicaset.name:
type: keyword
ignore_above: 1024
k8s.statefulset.name:
type: keyword
ignore_above: 1024
service.node.name:
type: alias
path: resource.attributes.service.instance.id
Expand Down Expand Up @@ -122,6 +146,30 @@ template:
kubernetes.pod.uid:
type: alias
path: resource.attributes.k8s.pod.uid
kubernetes.container.name:
type: alias
path: resource.attributes.k8s.container.name
kubernetes.cronjob.name:
type: alias
path: resource.attributes.k8s.cronjob.name
kubernetes.job.name:
type: alias
path: resource.attributes.k8s.job.name
kubernetes.statefulset.name:
type: alias
path: resource.attributes.k8s.statefulset.name
kubernetes.daemonset.name:
type: alias
path: resource.attributes.k8s.daemonset.name
kubernetes.replicaset.name:
type: alias
path: resource.attributes.k8s.replicaset.name
kubernetes.node.uid:
type: alias
path: resource.attributes.k8s.node.uid
kubernetes.node.hostname:
type: alias
path: resource.attributes.k8s.node.hostname
# Below are non-ECS fields that may be used by Kibana.
service.language.name:
type: alias
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,40 @@ host.name pass-through:
- length: { hits.hits: 1 }
- match: { hits.hits.0.fields.resource\.attributes\.host\.name: [ "localhost" ] }
- match: { hits.hits.0.fields.host\.name: [ "localhost" ] }
---
"kubernetes.* -> resource.attributes.k8s.* aliases":
- do:
bulk:
index: logs-generic.otel-default
refresh: true
body:
- create: { }
- "@timestamp": 2024-07-18T14:48:33.467654000Z
data_stream:
dataset: generic.otel
namespace: default
resource:
attributes:
k8s.container.name: myContainerName
k8s.cronjob.name: myCronJobName
k8s.job.name: myJobName
k8s.statefulset.name: myStatefulsetName
k8s.daemonset.name: myDaemonsetName
k8s.replicaset.name: myReplicasetName
k8s.node.uid: myNodeUid
k8s.node.hostname: myNodeHostname
- is_false: errors
- do:
search:
index: logs-generic.otel-default
body:
fields: ["kubernetes.container.name", "kubernetes.cronjob.name", "kubernetes.job.name", "kubernetes.statefulset.name", "kubernetes.daemonset.name", "kubernetes.replicaset.name", "kubernetes.node.uid", "kubernetes.node.hostname" ]
- length: { hits.hits: 1 }
- match: { hits.hits.0.fields.kubernetes\.container\.name : ["myContainerName"] }
- match: { hits.hits.0.fields.kubernetes\.cronjob\.name : ["myCronJobName"] }
- match: { hits.hits.0.fields.kubernetes\.job\.name : ["myJobName"] }
- match: { hits.hits.0.fields.kubernetes\.statefulset\.name : ["myStatefulsetName"] }
- match: { hits.hits.0.fields.kubernetes\.daemonset\.name : ["myDaemonsetName"] }
- match: { hits.hits.0.fields.kubernetes\.replicaset\.name : ["myReplicasetName"] }
- match: { hits.hits.0.fields.kubernetes\.node\.uid : ["myNodeUid"] }
- match: { hits.hits.0.fields.kubernetes\.node\.hostname : ["myNodeHostname"] }

0 comments on commit 37c7137

Please sign in to comment.