{{- if .Values.logsAgent.enabled }} apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-logs-agent labels: {{ include "stackstate-k8s-agent.labels" . | indent 4 }} app.kubernetes.io/component: logs-agent data: promtail.yaml: | server: http_listen_port: 9080 grpc_listen_port: 0 clients: - url: {{ tpl .Values.stackstate.url . }}/logs/k8s?api_key=${STS_API_KEY} external_labels: sts_cluster_name: {{ .Values.stackstate.cluster.name | quote }} positions: filename: /tmp/positions.yaml target_config: sync_period: 10s scrape_configs: - job_name: pod-logs kubernetes_sd_configs: - role: pod pipeline_stages: - docker: {} - cri: {} relabel_configs: - action: replace source_labels: - __meta_kubernetes_pod_name target_label: pod_name - action: replace source_labels: - __meta_kubernetes_pod_uid target_label: pod_uid - action: replace source_labels: - __meta_kubernetes_pod_container_name target_label: container_name # The __path__ is required by the promtail client - replacement: /var/log/pods/*$1/*.log separator: / source_labels: - __meta_kubernetes_pod_uid - __meta_kubernetes_pod_container_name target_label: __path__ # Drop all remaining labels, we do not need those - action: drop regex: __meta_(.*) {{- end -}}