fix(opentelemetry): update log ingestion settings and enhance transformation logic

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-04-21 14:38:55 +08:00
parent b97d5228d9
commit 19626a44fa

View File

@ -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 }}