The log store shipped in t_34ddaa83 but nothing could read it: the Loki datasource ConfigMap was live and written into Grafana's provisioning volume, and Grafana still listed only Prometheus + Alertmanager. Root cause was not the ConfigMap. The datasource sidecar writes the file and then POSTs /api/admin/provisioning/datasources/reload with monitoring/grafana-admin, which was 401-ing because Grafana's DB password had drifted from that Secret (the documented "the Secret is only the seed" behaviour) — Grafana reads provisioning/datasources only at startup, so the datasource never loaded. - Reset the live admin password to the Secret's value (in-pod `grafana cli admin reset-admin-password`, value read from the Secret and never printed), so seed and DB match again and the sidecar's reload returns 200. Documented in docs/grafana-persistence.md, including the sidecar consequence of drift. - New generated dashboard `logs` (uid: logs) with the two queries worth having: secret access over time by user from the apiserver audit stream, and pod errors by namespace, plus the runner namespaces and a note panel on field names. - The audit stream's names are the Alloy allowlist's, not the audit event's: objectRef.resource arrives as the stream label `resource` and user.username as the field `user`. `| json | objectRef_resource="secrets"` returns 0 rows (measured); the panels use `resource="secrets"` in the selector + `| json` for the user dimension. No pipeline, retention or filter change. - Runner panels discover their namespace via a `runner_ns` variable (.*(runner|forgejo).*) instead of pinning one name, so the t_2bbe34a8 move to ci-runners needs no edit here. - validate_panels.py now dispatches on the target's datasource and queries Loki for `loki` panels (a logs panel must return rows, not just series).
523 lines
16 KiB
YAML
523 lines
16 KiB
YAML
# GENERATED by monitoring/controllers/home/dashboards/build.py — edit the script, not this file.
|
|
# Provisioned by the kube-prometheus-stack dashboard sidecar (label grafana_dashboard=1,
|
|
# NAMESPACE=ALL), so it wins over any UI edit. Dashboard uid: logs
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: grafana-dashboard-logs
|
|
namespace: monitoring
|
|
labels:
|
|
grafana_dashboard: "1"
|
|
app.kubernetes.io/part-of: homelab-dashboards
|
|
annotations:
|
|
homelab.siriusdevops.com/managed-by: monitoring/controllers/home/dashboards/build.py
|
|
data:
|
|
logs.json: |
|
|
{
|
|
"uid": "logs",
|
|
"title": "Logs",
|
|
"description": "Loki single-binary in the `logging` namespace (192 h retention) holds pod logs, node journals, the Pi's docker logs and the kube-apiserver audit stream. The audit panels answer 'who read that credential'; the pod panels answer 'what did the pod say before it died'. Field names are the Alloy pipeline's allowlist, not the raw audit event's \u2014 see the note panel.",
|
|
"tags": [
|
|
"homelab",
|
|
"logs",
|
|
"loki",
|
|
"audit"
|
|
],
|
|
"timezone": "browser",
|
|
"editable": true,
|
|
"graphTooltip": 1,
|
|
"schemaVersion": 39,
|
|
"version": 1,
|
|
"refresh": "30s",
|
|
"time": {
|
|
"from": "now-6h",
|
|
"to": "now"
|
|
},
|
|
"annotations": {
|
|
"list": [
|
|
{
|
|
"builtIn": 1,
|
|
"datasource": {
|
|
"type": "grafana",
|
|
"uid": "-- Grafana --"
|
|
},
|
|
"enable": true,
|
|
"hide": true,
|
|
"iconColor": "rgba(0, 211, 255, 1)",
|
|
"name": "Annotations & Alerts",
|
|
"type": "dashboard"
|
|
}
|
|
]
|
|
},
|
|
"links": [],
|
|
"templating": {
|
|
"list": [
|
|
{
|
|
"name": "namespace",
|
|
"label": "Namespace",
|
|
"type": "query",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"refresh": 2,
|
|
"includeAll": true,
|
|
"multi": true,
|
|
"allValue": ".*",
|
|
"current": {
|
|
"selected": true,
|
|
"text": [
|
|
"All"
|
|
],
|
|
"value": [
|
|
"$__all"
|
|
]
|
|
},
|
|
"options": [],
|
|
"query": {
|
|
"query": "label_values({job=\"kube/pods\"}, namespace)",
|
|
"refId": "LokiNamespace"
|
|
}
|
|
},
|
|
{
|
|
"name": "runner_ns",
|
|
"label": "Runner namespace",
|
|
"type": "query",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"refresh": 2,
|
|
"includeAll": true,
|
|
"multi": true,
|
|
"allValue": ".*(runner|forgejo).*",
|
|
"current": {
|
|
"selected": true,
|
|
"text": [
|
|
"All"
|
|
],
|
|
"value": [
|
|
"$__all"
|
|
]
|
|
},
|
|
"options": [],
|
|
"query": {
|
|
"query": "label_values({job=\"kube/pods\", namespace=~\".*(runner|forgejo).*\"}, namespace)",
|
|
"refId": "LokiRunnerNamespace"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"panels": [
|
|
{
|
|
"id": 68,
|
|
"type": "row",
|
|
"title": "kube-apiserver audit \u2014 secret access",
|
|
"collapsed": false,
|
|
"gridPos": {
|
|
"h": 1,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 0
|
|
},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 69,
|
|
"type": "stat",
|
|
"title": "Secret events (1h)",
|
|
"description": "Count of audit records whose object is a Secret, filtered on the stream labels the Alloy audit pipeline emits. No log-line parsing involved.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 5,
|
|
"w": 4,
|
|
"x": 0,
|
|
"y": 1
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "sum(count_over_time({job=\"kube/apiserver-audit\", resource=\"secrets\"}[1h]))",
|
|
"refId": "A",
|
|
"queryType": "instant",
|
|
"range": false,
|
|
"instant": true
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"color": {
|
|
"mode": "thresholds"
|
|
},
|
|
"mappings": [],
|
|
"thresholds": {
|
|
"mode": "absolute",
|
|
"steps": [
|
|
{
|
|
"color": "red",
|
|
"value": null
|
|
},
|
|
{
|
|
"color": "green",
|
|
"value": 1
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"overrides": []
|
|
},
|
|
"options": {
|
|
"colorMode": "value",
|
|
"graphMode": "area",
|
|
"reduceOptions": {
|
|
"calcs": [
|
|
"lastNotNull"
|
|
],
|
|
"fields": "",
|
|
"values": false
|
|
},
|
|
"textMode": "auto",
|
|
"justifyMode": "auto"
|
|
}
|
|
},
|
|
{
|
|
"id": 70,
|
|
"type": "timeseries",
|
|
"title": "Secret access by user",
|
|
"description": "The 'who read that credential' view. `user` comes from user.username in the audit record, so `| json` is needed for the grouping; the resource filter stays in the selector as a label matcher.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 8,
|
|
"w": 20,
|
|
"x": 4,
|
|
"y": 1
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "sum by (user) (count_over_time({job=\"kube/apiserver-audit\", resource=\"secrets\"} | json [5m]))",
|
|
"refId": "A",
|
|
"queryType": "range",
|
|
"range": true,
|
|
"instant": false,
|
|
"legendFormat": "{{user}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"custom": {
|
|
"lineWidth": 1,
|
|
"fillOpacity": 10,
|
|
"showPoints": "never",
|
|
"stacking": {
|
|
"mode": "normal"
|
|
}
|
|
},
|
|
"color": {
|
|
"mode": "palette-classic"
|
|
}
|
|
},
|
|
"overrides": []
|
|
},
|
|
"options": {
|
|
"legend": {
|
|
"displayMode": "list",
|
|
"placement": "bottom",
|
|
"calcs": [
|
|
"lastNotNull"
|
|
]
|
|
},
|
|
"tooltip": {
|
|
"mode": "multi",
|
|
"sort": "desc"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": 71,
|
|
"type": "logs",
|
|
"title": "Secret access log \u2014 verb, object, caller",
|
|
"description": "One line per audit record that touched a Secret. Secret bodies are never stored: the pipeline allowlists fields and drops requestObject/responseObject.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 10,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 9
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "{job=\"kube/apiserver-audit\", resource=\"secrets\"} | json | line_format \"{{.verb}} {{.subresource}}{{.ns}}/{{.name}} \u2014 {{.user}} ({{.code}})\"",
|
|
"refId": "A",
|
|
"queryType": "range",
|
|
"range": true,
|
|
"instant": false
|
|
}
|
|
],
|
|
"options": {
|
|
"showTime": true,
|
|
"showLabels": false,
|
|
"showCommonLabels": false,
|
|
"wrapLogMessage": true,
|
|
"prettifyLogMessage": false,
|
|
"enableLogDetails": true,
|
|
"dedupStrategy": "none",
|
|
"sortOrder": "Descending"
|
|
}
|
|
},
|
|
{
|
|
"id": 72,
|
|
"type": "row",
|
|
"title": "Pod logs",
|
|
"collapsed": false,
|
|
"gridPos": {
|
|
"h": 1,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 19
|
|
},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 73,
|
|
"type": "logs",
|
|
"title": "Errors \u2014 namespace = $namespace",
|
|
"description": "The ordinary 'what did the pod say before it died' query. Substring filter, so it catches `error` anywhere in the line.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 9,
|
|
"w": 12,
|
|
"x": 0,
|
|
"y": 20
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "{job=\"kube/pods\", namespace=~\"$namespace\"} |= \"error\"",
|
|
"refId": "A",
|
|
"queryType": "range",
|
|
"range": true,
|
|
"instant": false
|
|
}
|
|
],
|
|
"options": {
|
|
"showTime": true,
|
|
"showLabels": false,
|
|
"showCommonLabels": false,
|
|
"wrapLogMessage": true,
|
|
"prettifyLogMessage": false,
|
|
"enableLogDetails": true,
|
|
"dedupStrategy": "none",
|
|
"sortOrder": "Descending"
|
|
}
|
|
},
|
|
{
|
|
"id": 74,
|
|
"type": "logs",
|
|
"title": "Error / exception / fatal / panic (case-insensitive)",
|
|
"description": "Wider net for stacks that log `Exception`, `FATAL` or `panic:` instead of the word `error`.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 9,
|
|
"w": 12,
|
|
"x": 12,
|
|
"y": 20
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "{job=\"kube/pods\", namespace=~\"$namespace\"} |~ \"(?i)error|exception|fatal|panic\"",
|
|
"refId": "A",
|
|
"queryType": "range",
|
|
"range": true,
|
|
"instant": false
|
|
}
|
|
],
|
|
"options": {
|
|
"showTime": true,
|
|
"showLabels": false,
|
|
"showCommonLabels": false,
|
|
"wrapLogMessage": true,
|
|
"prettifyLogMessage": false,
|
|
"enableLogDetails": true,
|
|
"dedupStrategy": "none",
|
|
"sortOrder": "Descending"
|
|
}
|
|
},
|
|
{
|
|
"id": 75,
|
|
"type": "row",
|
|
"title": "CI runners (forgejo / forgejo-runners)",
|
|
"collapsed": false,
|
|
"gridPos": {
|
|
"h": 1,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 29
|
|
},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 76,
|
|
"type": "logs",
|
|
"title": "Runner pod logs",
|
|
"description": "Everything the runner pods print \u2014 job container output, dind, and the runner's own poll/registration lines. The namespace comes from the `runner_ns` variable, which matches any *runner* namespace (forgejo, forgejo-runners, ci-runners) so the panel survives the t_2bbe34a8 move without an edit.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 9,
|
|
"w": 12,
|
|
"x": 0,
|
|
"y": 30
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "{job=\"kube/pods\", namespace=~\"$runner_ns\"}",
|
|
"refId": "A",
|
|
"queryType": "range",
|
|
"range": true,
|
|
"instant": false
|
|
}
|
|
],
|
|
"options": {
|
|
"showTime": true,
|
|
"showLabels": false,
|
|
"showCommonLabels": false,
|
|
"wrapLogMessage": true,
|
|
"prettifyLogMessage": false,
|
|
"enableLogDetails": true,
|
|
"dedupStrategy": "none",
|
|
"sortOrder": "Descending"
|
|
}
|
|
},
|
|
{
|
|
"id": 77,
|
|
"type": "timeseries",
|
|
"title": "Runner error / fail lines per 5m",
|
|
"description": "Coarse CI pain signal. A silent stall (a build looping on `Ign:` with no error) does not show here \u2014 check the log panel above for that.",
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"gridPos": {
|
|
"h": 9,
|
|
"w": 12,
|
|
"x": 12,
|
|
"y": 30
|
|
},
|
|
"targets": [
|
|
{
|
|
"datasource": {
|
|
"type": "loki",
|
|
"uid": "loki"
|
|
},
|
|
"expr": "sum by (namespace) (count_over_time({job=\"kube/pods\", namespace=~\"$runner_ns\"} |~ \"(?i)error|fail\" [5m]))",
|
|
"refId": "A",
|
|
"queryType": "range",
|
|
"range": true,
|
|
"instant": false,
|
|
"legendFormat": "{{namespace}}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": {
|
|
"custom": {
|
|
"lineWidth": 1,
|
|
"fillOpacity": 10,
|
|
"showPoints": "never",
|
|
"stacking": {
|
|
"mode": "normal"
|
|
}
|
|
},
|
|
"color": {
|
|
"mode": "palette-classic"
|
|
}
|
|
},
|
|
"overrides": []
|
|
},
|
|
"options": {
|
|
"legend": {
|
|
"displayMode": "list",
|
|
"placement": "bottom",
|
|
"calcs": [
|
|
"lastNotNull"
|
|
]
|
|
},
|
|
"tooltip": {
|
|
"mode": "multi",
|
|
"sort": "desc"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": 78,
|
|
"type": "row",
|
|
"title": "How to read these streams",
|
|
"collapsed": false,
|
|
"gridPos": {
|
|
"h": 1,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 39
|
|
},
|
|
"panels": []
|
|
},
|
|
{
|
|
"id": 79,
|
|
"type": "text",
|
|
"title": "Field names and retention",
|
|
"gridPos": {
|
|
"h": 8,
|
|
"w": 24,
|
|
"x": 0,
|
|
"y": 40
|
|
},
|
|
"options": {
|
|
"mode": "markdown",
|
|
"code": {
|
|
"language": "plaintext",
|
|
"showLineNumbers": false,
|
|
"showMiniMap": false
|
|
},
|
|
"content": "Loki is single-binary in the `logging` namespace: **192 h (8 d)** retention on an 8Gi PVC,\nfed by the Alloy DaemonSet. These panels only read it.\n\n| `job` | source | stream labels |\n|---|---|---|\n| `kube/pods` | every container's stdout (`/var/log/pods`) | `namespace, pod, container, node` |\n| `kube/apiserver-audit` | `siriussec`'s `/var/log/kubernetes/audit/audit.log` | `resource, verb` |\n| `systemd-journal` | node journals | `unit, host, level` |\n| `docker/json` | the Pi's docker container logs | `container` |\n\n**The audit field names are the Alloy pipeline's allowlist, not the raw audit event's.**\n`objectRef.resource` arrives as the stream label `resource` and `user.username` as the\nline field `user`, so the usable query is\n`{job=\"kube/apiserver-audit\", resource=\"secrets\"} | json` \u2014 an `objectRef_resource` or\n`user_username` matcher returns **zero rows**. Secret bodies are never shipped: the\npipeline packs an allowlist and drops `requestObject`/`responseObject`\n(`docs/logging.md`, `infrastructure/logging/alloy/config.alloy`)."
|
|
}
|
|
}
|
|
]
|
|
}
|