freeleaps-ops/freeleaps/helm-pkg/authentication/templates/authentication/opentelemetry.yaml
2025-04-21 15:15:30 +08:00

85 lines
2.5 KiB
YAML

{{- if .Values.logIngest.enabled }}
apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
name: {{ .Release.Name }}-opentelemetry-collector
namespace: {{ .Release.Namespace }}
spec:
mode: sidecar
image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest
serviceAccount: "{{ .Release.Name }}-otel-collector"
volumeMounts:
- name: app-logs
mountPath: {{ .Values.logIngest.logPath }}
securityContext:
allowPrivilegeEscalation: true
privileged: true
runAsUser: 0
runAsGroup: 0
config:
receivers:
filelog:
include:
- {{ .Values.logIngest.logPathPattern }}
start_at: end
include_file_path: false
include_file_name: false
operators:
- type: json_parser
parse_from: body
parse_to: attributes
processors:
k8sattributes:
auth_type: serviceAccount
wait_for_metadata: true
wait_for_metadata_timeout: 10s
passthrough: false
extract:
metadata:
- k8s.pod.name
- k8s.pod.ip
- k8s.pod.uid
- k8s.deployment.name
- k8s.deployment.uid
- k8s.namespace.name
- k8s.node.name
attributes/k8s:
actions:
- action: insert
key: kubernetes.pod_name
from_attribute: k8s.pod.name
- action: insert
key: kubernetes.pod_ip
from_attribute: k8s.pod.ip
- action: insert
key: kubernetes.pod_uid
from_attribute: k8s.pod.uid
- action: insert
key: kubernetes.deployment_name
from_attribute: k8s.deployment.name
- action: insert
key: kubernetes.deployment_uid
from_attribute: k8s.deployment.uid
- action: insert
key: kubernetes.namespace_name
from_attribute: k8s.namespace.name
- action: insert
key: kubernetes.node_name
from_attribute: k8s.node.name
batch:
send_batch_size: 5
timeout: 10s
exporters:
loki:
endpoint: {{ .Values.logIngest.lokiEndpoint }}
tls:
insecure: true
debug:
verbosity: detailed
service:
pipelines:
logs:
receivers: [filelog]
processors: [k8sattributes, attributes/k8s, batch]
exporters: [loki, debug]
{{- end }}