From 82db9b41b29bdbc6e9fd9ac1c12497a0727ae3dd Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Tue, 24 Nov 2026 21:22:41 +1100 Subject: [PATCH] Record per-host memory corruption log events from VictoriaLogs (#596) Hosts have no ECC RAM, so failing memory raises no EDAC/MCE signal; it only shows up as scattered log lines (kernel segfaults/GPFs, ceph checksum and rocksdb key-order errors). Recording a per-host count of these symptoms makes bad RAM visible in VictoriaMetrics. - add vmalert `logs` in logging, querying VictoriaLogs and writing to vminsert-main - add VMRule recording `host:corruption_log_events:count` by host from LogsQL - select vlogs rules by the `vmalert.unkin.net/datasource` label and exclude them from vmalert `main` Reviewed-on: https://git.unkin.net/unkin/argocd-apps/pulls/596 Co-authored-by: unkin-agent Co-committed-by: unkin-agent --- apps/base/logging/kustomization.yaml | 2 ++ apps/base/logging/vmalert.yaml | 36 ++++++++++++++++++++++++ apps/base/logging/vmrule-corruption.yaml | 21 ++++++++++++++ apps/base/observability/vmalert.yaml | 5 ++++ 4 files changed, 64 insertions(+) create mode 100644 apps/base/logging/vmalert.yaml create mode 100644 apps/base/logging/vmrule-corruption.yaml diff --git a/apps/base/logging/kustomization.yaml b/apps/base/logging/kustomization.yaml index 895cce9..8c6caab 100644 --- a/apps/base/logging/kustomization.yaml +++ b/apps/base/logging/kustomization.yaml @@ -7,5 +7,7 @@ resources: - vaultauth.yaml - vlcluster.yaml - vlagent.yaml + - vmalert.yaml + - vmrule-corruption.yaml - gateway.yaml - httproute.yaml diff --git a/apps/base/logging/vmalert.yaml b/apps/base/logging/vmalert.yaml new file mode 100644 index 0000000..a65ecae --- /dev/null +++ b/apps/base/logging/vmalert.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMAlert +metadata: + name: logs + namespace: logging +spec: + replicaCount: 2 + ruleSelector: + matchLabels: + vmalert.unkin.net/datasource: vlogs + evaluationInterval: 1m + datasource: + url: http://vlselect-logs.logging.svc.cluster.local:9471 + remoteWrite: + url: http://vminsert-main.observability.svc.cluster.local:8480/insert/0/prometheus/ + extraArgs: + loggerFormat: json + notifier.blackhole: "true" + podDisruptionBudget: + maxUnavailable: 1 + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/name: vmalert + app.kubernetes.io/instance: logs + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + cpu: 500m + memory: 512Mi diff --git a/apps/base/logging/vmrule-corruption.yaml b/apps/base/logging/vmrule-corruption.yaml new file mode 100644 index 0000000..1e4ecfd --- /dev/null +++ b/apps/base/logging/vmrule-corruption.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: operator.victoriametrics.com/v1beta1 +kind: VMRule +metadata: + name: corruption + namespace: logging + labels: + vmalert.unkin.net/datasource: vlogs +spec: + groups: + - name: corruption + type: vlogs + interval: 1m + rules: + # Hosts lack ECC, so log symptoms are the only signal of bad RAM. + - record: host:corruption_log_events:count + expr: | + ("segfault at" or "general protection fault" or "_verify_csum bad" or "block checksum mismatch" or "out-of-order keys") + | rename _HOSTNAME as host + | format if (host:"") "" as host + | stats by (host) count() as events diff --git a/apps/base/observability/vmalert.yaml b/apps/base/observability/vmalert.yaml index 930210a..045a806 100644 --- a/apps/base/observability/vmalert.yaml +++ b/apps/base/observability/vmalert.yaml @@ -7,6 +7,11 @@ metadata: spec: replicaCount: 1 selectAllByDefault: true + ruleNamespaceSelector: {} + ruleSelector: + matchExpressions: + - key: vmalert.unkin.net/datasource + operator: DoesNotExist evaluationInterval: 30s datasource: url: http://vmselect-main.observability.svc.cluster.local:8481/select/0/prometheus/