From 8dda0bada93a094bbcb586befcaac318d746d265 Mon Sep 17 00:00:00 2001 From: zhenyus Date: Mon, 21 Apr 2025 15:27:46 +0800 Subject: [PATCH] fix(opentelemetry): enhance log transformation by adding log statements and updating exporters Signed-off-by: zhenyus --- .../templates/authentication/opentelemetry.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml index dbe297f3..49bdb85e 100644 --- a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml +++ b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml @@ -66,12 +66,19 @@ spec: - action: insert key: kubernetes.node_name from_attribute: k8s.node.name + transform: + log_statements: + - context: log + statements: + - merge_maps(log.cache, ParseJSON(log.body), "upsert") + - set(log.cache["kubernetes"], resource.attributes["kubernetes"]) + - set(log.body, log.cache) batch: send_batch_size: 5 timeout: 10s exporters: - loki: - endpoint: {{ .Values.logIngest.lokiEndpoint }} + otlphttp: + endpoint: {{ .Values.logIngest.lokiEndpoint }}/otlp tls: insecure: true debug: @@ -80,6 +87,6 @@ spec: pipelines: logs: receivers: [filelog] - processors: [k8sattributes, attributes/k8s, batch] - exporters: [loki, debug] + processors: [k8sattributes, attributes/k8s, transform, batch] + exporters: [otlphttp, debug] {{- end }} \ No newline at end of file