From 544293f7b28cf620d102d99885432baf4b3e61d4 Mon Sep 17 00:00:00 2001 From: zhenyus Date: Mon, 21 Apr 2025 15:05:05 +0800 Subject: [PATCH] fix(opentelemetry): refine log processing by removing unnecessary fields and enhancing attribute insertion Signed-off-by: zhenyus --- .../authentication/opentelemetry.yaml | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml index bb4696dc..e3b4c950 100644 --- a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml +++ b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml @@ -26,11 +26,11 @@ spec: include_file_name: false operators: - type: json_parser - - type: remove - field: body + parse_from: body + parse_to: attributes processors: k8sattributes: - auth_type: "serviceAccount" + auth_type: serviceAccount wait_for_metadata: true wait_for_metadata_timeout: 10s passthrough: false @@ -43,27 +43,29 @@ spec: - k8s.deployment.uid - k8s.namespace.name - k8s.node.name - pod_association: - - sources: - - from: resource_attribute - name: k8s.pod.ip - - sources: - - from: resource_attribute - name: k8s.pod.uid - - sources: - - from: connection - resource: - attributes: - - key: loki.format - action: insert - value: json - transform: - log_statements: - - context: log - statements: - - set(body, body.attributes) - - delete_key(body, "attributes") - - delete_key(body, "resources") + attributes/k8s: + actions: + - action: insert + key: kubernetes.pod_name + from_attribute: k8s.pod.name + - action: insert + key: kubernetes.pod_ip + from_attribute: k8s.pod.ip + - action: insert + key: kubernetes.pod_uid + from_attribute: k8s.pod.uid + - action: insert + key: kubernetes.deployment_name + from_attribute: k8s.deployment.name + - action: insert + key: kubernetes.deployment_uid + from_attribute: k8s.deployment.uid + - action: insert + key: kubernetes.namespace_name + from_attribute: k8s.namespace.name + - action: insert + key: kubernetes.node_name + from_attribute: k8s.node.name batch: send_batch_size: 1000 timeout: 10s @@ -73,12 +75,9 @@ spec: tls: insecure: true service: - telemetry: - logs: - level: "info" pipelines: logs: receivers: [filelog] - processors: [k8sattributes, resource, transform, batch] + processors: [k8sattributes, attributes/k8s, batch] exporters: [loki] {{- end }} \ No newline at end of file