iac/infrastructure/opentelemetry-agent/base/collector.yaml

96 lines
2.8 KiB
YAML

extensions:
health_check: {endpoint: "0.0.0.0:13133"}
file_storage/checkpoints:
directory: /var/lib/otelcol-service-logs/checkpoints
create_directory: true
fsync: true
file_storage/queue:
directory: /var/lib/otelcol-service-logs/queue
create_directory: true
fsync: true
compaction:
on_start: true
directory: /var/lib/otelcol-service-logs/queue
receivers:
filelog/pods:
include: [/var/log/pods/*/*/*.log]
exclude:
# Avoid collecting this pipeline's own errors, including audit S3 debug echoes.
- /var/log/pods/opentelemetry-agent_*/*/*.log
- /var/log/pods/opentelemetry-collector_*/*/*.log
- /var/log/pods/vector_*/*/*.log
- /var/log/pods/security-audit_*/*/*.log
start_at: end
include_file_path: true
storage: file_storage/checkpoints
max_log_size: 1MiB
poll_interval: 1s
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 30s
max_elapsed_time: 0s
operators:
# Detect CRI/Docker format and reassemble runtime partial records.
- {type: container, id: container-parser}
- type: json_parser
id: application-json
if: 'body matches "^\\s*\\{"'
parse_to: attributes["app"]
on_error: send
processors:
memory_limiter: {check_interval: 1s, limit_mib: 600, spike_limit_mib: 100}
k8sattributes:
auth_type: serviceAccount
passthrough: false
filter:
node_from_env_var: K8S_NODE_NAME
extract:
metadata:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
- k8s.node.name
- k8s.container.name
labels:
- {tag_name: service.name, key: app.kubernetes.io/name, from: pod}
- {tag_name: app, key: app, from: pod}
pod_association:
- sources:
- {from: resource_attribute, name: k8s.pod.uid}
- sources:
- {from: resource_attribute, name: k8s.namespace.name}
- {from: resource_attribute, name: k8s.pod.name}
exporters:
otlp/logs:
endpoint: otel-collector.opentelemetry-collector.svc.cluster.local:4317
tls: {insecure: true}
compression: gzip
# Vector acknowledges only after S3 upload; this must exceed its 300s batch age.
timeout: 660s
sending_queue:
enabled: true
storage: file_storage/queue
num_consumers: 8
queue_size: 2048
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 0s
service:
extensions: [health_check, file_storage/checkpoints, file_storage/queue]
pipelines:
logs:
receivers: [filelog/pods]
# No batch processor: do not acknowledge a read before the persistent queue.
processors: [memory_limiter, k8sattributes]
exporters: [otlp/logs]
telemetry:
logs: {level: info}
metrics: {address: "0.0.0.0:8888"}