diff --git a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml index be31de9f..d0fa780c 100644 --- a/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml +++ b/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml @@ -25,8 +25,8 @@ spec: include_file_path: true include_file_name: true operators: + # 简单解析JSON,不改变结构 - type: json_parser - id: json_parser processors: k8sattributes: auth_type: "serviceAccount" @@ -60,11 +60,14 @@ spec: - key: loki.format action: insert value: json + # 使用transform将k8s和资源属性添加到原始JSON中 transform: log_statements: - context: log statements: - - merge_maps(attributes, resource.attributes) + - set(body["k8s"], resource.attributes["k8s.pod.name"]) + - set(body["service"], resource.attributes["service.name"]) + - set(body["namespace"], resource.attributes["service.namespace"]) batch: send_batch_size: 1000 timeout: 10s @@ -73,6 +76,7 @@ spec: endpoint: {{ .Values.logIngest.lokiEndpoint }} tls: insecure: true + format: json debug: verbosity: detailed service: