From 64f2c993c167984211177855c8a6d03191f27849 Mon Sep 17 00:00:00 2001 From: Vic Cross Date: Wed, 3 Jul 2024 17:29:17 +1000 Subject: [PATCH] Promtail and dashboard changes for z/VM --- .../files/dashboard-logs.json | 39 +++++++++++++++++-- .../files/promtail-cfg-syslog.yaml | 21 ++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/local-playbooks/roles/setup-grafana-log-viewer/files/dashboard-logs.json b/local-playbooks/roles/setup-grafana-log-viewer/files/dashboard-logs.json index 465e7bf..843e0f6 100644 --- a/local-playbooks/roles/setup-grafana-log-viewer/files/dashboard-logs.json +++ b/local-playbooks/roles/setup-grafana-log-viewer/files/dashboard-logs.json @@ -102,7 +102,7 @@ "uid": "elanLoki" }, "editorMode": "builder", - "expr": "{application=\"VMCONS\"} |= `` | line_format \"{{ .hostname }} {{__line__}}\"", + "expr": "{application=\"VMCONS\", zvm_guest=~\"${guestname}\"} |= `` | line_format \"{{ .zvm_guest }} {{__line__}}\"", "queryType": "range", "refId": "A" } @@ -153,7 +153,7 @@ "uid": "elanLoki" }, "editorMode": "builder", - "expr": "{application=\"VMEVENT\"} |= ``", + "expr": "{application=\"VMEVENT\", zvm_guest=~\"${guestname}\"} |= ``", "queryType": "range", "refId": "A" } @@ -167,7 +167,38 @@ "style": "dark", "tags": [], "templating": { - "list": [] + "list": [ + { + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "elanLoki" + }, + "definition": "", + "description": "Filter on z/VM guest name", + "hide": 0, + "includeAll": true, + "label": "z/VM guest name", + "multi": true, + "name": "guestname", + "options": [], + "query": { + "label": "zvm_guest", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 2, + "regex": "/^(?!(?:localhost)$)(.+)/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] }, "time": { "from": "now-6h", @@ -177,6 +208,6 @@ "timezone": "", "title": "z/VM ESI System Messages", "uid": "RfzH9eoSz", - "version": 2, + "version": 4, "weekStart": "" } \ No newline at end of file diff --git a/local-playbooks/roles/setup-grafana-log-viewer/files/promtail-cfg-syslog.yaml b/local-playbooks/roles/setup-grafana-log-viewer/files/promtail-cfg-syslog.yaml index f453f38..76117d3 100644 --- a/local-playbooks/roles/setup-grafana-log-viewer/files/promtail-cfg-syslog.yaml +++ b/local-playbooks/roles/setup-grafana-log-viewer/files/promtail-cfg-syslog.yaml @@ -26,3 +26,24 @@ scrape_configs: target_label: application - source_labels: [__syslog_message_facility] target_label: facility + pipeline_stages: + - match: + pipeline_name: vmcons + selector: '{application="VMCONS"}' + stages: + - labels: + zvm_guest: hostname + - labeldrop: + - hostname + - level + - facility + - match: + pipeline_name: vmevent + selector: '{application="VMEVENT"}' + stages: + - labels: + zvm_guest: hostname + - labeldrop: + - hostname + - level + - facility