From b89cfa49fd5fa6dd6e30f8170d323de543ec2120 Mon Sep 17 00:00:00 2001 From: miwr Date: Thu, 24 Apr 2025 10:17:25 +0200 Subject: [PATCH] alloy config added --- template/stacks/monitoring/alloy/values.yaml | 21 +++++++++++++++++++ .../create-logging-directory.yaml | 4 ++-- .../openbao-logging/logrotate-cronjob.yaml | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/template/stacks/monitoring/alloy/values.yaml b/template/stacks/monitoring/alloy/values.yaml index a2ac67d..44e9fdc 100644 --- a/template/stacks/monitoring/alloy/values.yaml +++ b/template/stacks/monitoring/alloy/values.yaml @@ -1,8 +1,19 @@ +controller: + volumes: + - name: host-log-storage + hostPath: + path: /var/log + type: Directory alloy: create: false name: alloy-config key: config.alloy + mounts: + - mountPath: /openbao/logs + name: host-log-storage + readOnly: true + uiPathPrefix: "/alloy" configMap: @@ -72,6 +83,16 @@ alloy: } + local.file_match "file_logs" { + path_targets = [{"__path__" = "/openbao/logs/openbao/*"}] + sync_period = "5s" + } + + loki.source.file "local_files" { + targets = local.file_match.file_logs.targets + forward_to = [loki.write.local_loki.receiver] + } + loki.source.kubernetes "all_pod_logs" { targets = discovery.relabel.pod_logs.output forward_to = [loki.write.local_loki.receiver] diff --git a/template/stacks/ref-implementation/openbao-logging/create-logging-directory.yaml b/template/stacks/ref-implementation/openbao-logging/create-logging-directory.yaml index 20192e3..8ee41b7 100644 --- a/template/stacks/ref-implementation/openbao-logging/create-logging-directory.yaml +++ b/template/stacks/ref-implementation/openbao-logging/create-logging-directory.yaml @@ -20,7 +20,7 @@ spec: - | set -e mkdir -p /var/log/openbao - chown 100:100 /var/log/openbao + chown 100:100 /var/log/openbao securityContext: runAsUser: 0 volumeMounts: @@ -29,7 +29,7 @@ spec: containers: - name: running-container image: busybox - command: ["sleep", "2"] + command: ["sleep", "infinity"] securityContext: runAsUser: 0 volumes: diff --git a/template/stacks/ref-implementation/openbao-logging/logrotate-cronjob.yaml b/template/stacks/ref-implementation/openbao-logging/logrotate-cronjob.yaml index c8b80c4..9d1bb44 100644 --- a/template/stacks/ref-implementation/openbao-logging/logrotate-cronjob.yaml +++ b/template/stacks/ref-implementation/openbao-logging/logrotate-cronjob.yaml @@ -5,6 +5,8 @@ metadata: namespace: openbao spec: schedule: "0 * * * *" + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 jobTemplate: spec: template: