From 19626a44fadf812c81810163b73e5a37e0dfc931 Mon Sep 17 00:00:00 2001 From: zhenyus Date: Mon, 21 Apr 2025 14:38:55 +0800 Subject: [PATCH] fix(opentelemetry): update log ingestion settings and enhance transformation logic Signed-off-by: zhenyus --- .../authentication/opentelemetry.yaml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml index 11952810..d2c1b483 100644 --- a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml +++ b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml @@ -22,10 +22,9 @@ spec: include: - {{ .Values.logIngest.logPathPattern }} start_at: end - include_file_path: true - include_file_name: true + include_file_path: false + include_file_name: false operators: - # 简单解析JSON,不改变结构 - type: json_parser - type: remove field: body @@ -55,15 +54,16 @@ spec: - from: connection resource: attributes: - - key: service.name - value: "{{ .Release.Name }}" - action: upsert - - key: service.namespace - value: "{{ .Release.Namespace }}" - action: upsert - key: loki.format action: insert value: json + transform: + log_statements: + - context: log + statements: + - merge_maps(body, body.attributes) + - delete_key(body, "attributes") + - delete_key(body, "resources") batch: send_batch_size: 1000 timeout: 10s @@ -79,6 +79,6 @@ spec: pipelines: logs: receivers: [filelog] - processors: [k8sattributes, resource, batch] + processors: [k8sattributes, resource, transform, batch] exporters: [loki] {{- end }} \ No newline at end of file