fix(opentelemetry): restore and configure k8sattributes processor for enhanced metadata extraction
Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
parent
c08ddf7f76
commit
9ceaaa3e0b
@ -29,35 +29,44 @@ spec:
|
||||
parse_from: body
|
||||
parse_to: attributes
|
||||
processors:
|
||||
# k8sattributes:
|
||||
# auth_type: serviceAccount
|
||||
# wait_for_metadata: true
|
||||
# wait_for_metadata_timeout: 10s
|
||||
# passthrough: false
|
||||
# extract:
|
||||
# metadata:
|
||||
# - k8s.pod.name
|
||||
# - k8s.pod.ip
|
||||
# - k8s.pod.uid
|
||||
# - k8s.deployment.name
|
||||
# - k8s.deployment.uid
|
||||
# - k8s.namespace.name
|
||||
# - k8s.node.name
|
||||
# resource:
|
||||
# attributes:
|
||||
# - action: upsert
|
||||
# key: application
|
||||
# from_attribute: context.app
|
||||
# - action: upsert
|
||||
# key: environment
|
||||
# from_attribute: context.env
|
||||
k8sattributes:
|
||||
auth_type: serviceAccount
|
||||
wait_for_metadata: true
|
||||
wait_for_metadata_timeout: 5s
|
||||
passthrough: false
|
||||
extract:
|
||||
metadata:
|
||||
- k8s.pod.name
|
||||
- k8s.pod.ip
|
||||
- k8s.pod.uid
|
||||
- k8s.deployment.name
|
||||
- k8s.deployment.uid
|
||||
- k8s.namespace.name
|
||||
- k8s.node.name
|
||||
pod_association:
|
||||
- sources:
|
||||
- from: resource_attributes
|
||||
name: k8s.pod.name
|
||||
- sources:
|
||||
- from: resource_attributes
|
||||
name: k8s.pod.uid
|
||||
- source:
|
||||
- from: connection
|
||||
transform:
|
||||
log_statements:
|
||||
- context: log
|
||||
statements:
|
||||
- set(log.body["kubernetes"], log.attributes["kubernetes"])
|
||||
- set(resource.attributes["application"], log.attributes["context"]["app"])
|
||||
- set(resource.attributes["environment"], log.attributes["context"]["env"])
|
||||
- set(resource.attributes["kubernetes_node_name"])
|
||||
- set(log.body["kubernetes"]["pod"], resource.attributes["k8s.pod.name"])
|
||||
- set(log.body["kubernetes"]["namespace"], resource.attributes["k8s.namespace.name"])
|
||||
- set(log.body["kubernetes"]["pod_ip"], resource.attributes["k8s.pod.ip"])
|
||||
- set(log.body["kubernetes"]["pod_uid"], resource.attributes["k8s.pod.uid"])
|
||||
- set(log.body["kubernetes"]["deployment"], resource.attributes["k8s.deployment.name"])
|
||||
- set(log.body["kubernetes"]["deployment_uid"], resource.attributes["k8s.deployment.uid"])
|
||||
- set(log.body["kubernetes"]["node"], resource.attributes["k8s.node.name"])
|
||||
- set(log.body["kubernetes"]["namespace"], resource.attributes["k8s.namespace.name"])
|
||||
batch:
|
||||
send_batch_size: 5
|
||||
timeout: 10s
|
||||
@ -75,6 +84,6 @@ spec:
|
||||
pipelines:
|
||||
logs:
|
||||
receivers: [filelog]
|
||||
processors: [transform, batch]
|
||||
processors: [k8sattributes, transform, batch]
|
||||
exporters: [otlphttp/logs, debug]
|
||||
{{- end }}
|
||||
Loading…
Reference in New Issue
Block a user