From 22ab4b99ef87c1355ec40c3605abdb126a323580 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 29 Jul 2025 13:59:25 +0800 Subject: [PATCH 1/2] fix: simplify OpenTelemetry Collector config to resolve timestamp parsing errors --- .../central-storage/opentelemetry.yaml | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml b/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml index 763594a9..a3746bb6 100644 --- a/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml +++ b/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml @@ -56,6 +56,7 @@ spec: timestamp: parse_from: attributes.timestamp layout: UnixMilli + location: UTC processors: resource: attributes: @@ -77,27 +78,6 @@ spec: - action: insert key: k8s.deployment.name value: ${KUBE_META_OBJECT_NAME} - transform: - log_statements: - - context: log - statements: - - set(resource.attributes["application"], log.attributes["context"]["app"]) - - set(resource.attributes["environment"], log.attributes["context"]["env"]) - - set(resource.attributes["kubernetes_node_name"], resource.attributes["k8s.node.name"]) - - set(resource.attributes["kubernetes_pod_name"], resource.attributes["k8s.pod.name"]) - - set(resource.attributes["kubernetes_pod_ip"], resource.attributes["k8s.pod.ip"]) - - set(resource.attributes["kubernetes_deployment_name"], resource.attributes["k8s.deployment.name"]) - - set(resource.attributes["kubernetes_namespace"], resource.attributes["k8s.namespace.name"]) - - set(resource.attributes["body_json"], ParseJSON(log.body)) - - set(resource.attributes["body_json"]["kubernetes"]["pod"], resource.attributes["k8s.pod.name"]) - - set(resource.attributes["body_json"]["kubernetes"]["namespace"], resource.attributes["k8s.namespace.name"]) - - set(resource.attributes["body_json"]["kubernetes"]["pod_ip"], resource.attributes["k8s.pod.ip"]) - - set(resource.attributes["body_json"]["kubernetes"]["pod_uid"], resource.attributes["k8s.pod.uid"]) - - set(resource.attributes["body_json"]["kubernetes"]["deployment"], resource.attributes["k8s.deployment.name"]) - - set(resource.attributes["body_json"]["kubernetes"]["node"], resource.attributes["k8s.node.name"]) - - set(resource.attributes["body_json"]["kubernetes"]["namespace"], resource.attributes["k8s.namespace.name"]) - - set(log.body, resource.attributes["body_json"]) - - delete_key(resource.attributes, "body_json") batch: send_batch_size: 5 timeout: 10s @@ -113,6 +93,6 @@ spec: pipelines: logs: receivers: [filelog] - processors: [resource, transform, batch] + processors: [resource, batch] exporters: [otlphttp/logs] {{- end }} \ No newline at end of file From aa8e626b7ab9b68f2cc2bd2a3f4487aa3b669191 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 29 Jul 2025 14:30:00 +0800 Subject: [PATCH 2/2] fix: remove problematic ParseJSON operations from OpenTelemetry transform processor --- .../templates/central-storage/opentelemetry.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml b/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml index a3746bb6..cc6db0a0 100644 --- a/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml +++ b/freeleaps/helm-pkg/centralStorage/templates/central-storage/opentelemetry.yaml @@ -78,6 +78,17 @@ spec: - action: insert key: k8s.deployment.name value: ${KUBE_META_OBJECT_NAME} + transform: + log_statements: + - context: log + statements: + - set(resource.attributes["application"], log.attributes["context"]["app"]) + - set(resource.attributes["environment"], log.attributes["context"]["env"]) + - set(resource.attributes["kubernetes_node_name"], resource.attributes["k8s.node.name"]) + - set(resource.attributes["kubernetes_pod_name"], resource.attributes["k8s.pod.name"]) + - set(resource.attributes["kubernetes_pod_ip"], resource.attributes["k8s.pod.ip"]) + - set(resource.attributes["kubernetes_deployment_name"], resource.attributes["k8s.deployment.name"]) + - set(resource.attributes["kubernetes_namespace"], resource.attributes["k8s.namespace.name"]) batch: send_batch_size: 5 timeout: 10s @@ -93,6 +104,6 @@ spec: pipelines: logs: receivers: [filelog] - processors: [resource, batch] + processors: [resource, transform, batch] exporters: [otlphttp/logs] {{- end }} \ No newline at end of file