fix(opentelemetry): enhance log transformation by adding log statements and updating exporters

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-04-21 15:27:46 +08:00
parent 4d591a03c0
commit 8dda0bada9

View File

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