Grafana Dashboard Generic Loki

From UVOO Tech Wiki
Revision as of 16:13, 9 July 2025 by Busk (talk | contribs) (Created page with "``` { "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor":...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "gridPos": {
        "h": 12,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "enableLogDetails": true,
        "prettifyLogMessage": false,
        "showLabels": true,
        "showTime": true,
        "wrapLogMessage": true
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "{job=~\"$job\", namespace=~\"$namespace\", level=~\"$level\"} |= \"$filter\"",
          "refId": "A"
        }
      ],
      "title": "Loki Logs",
      "type": "logs"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "axisSoftMax": null,
            "axisSoftMin": null,
            "barAlignment": 0,
            "drawStyle": "line",
            "fillGradient": 0,
            "fillOpacity": 10,
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "color": {
            "mode": "palette-classic"
          },
          "unit": "logunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 12
      },
      "id": 4,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${datasource}"
          },
          "expr": "sum by(level) (rate({job=~\"$job\", namespace=~\"$namespace\", level=~\"$level\"} |~ \"$filter\" [$__interval]))",
          "refId": "A"
        }
      ],
      "title": "Log Rate by Level",
      "type": "timeseries"
    }
  ],
  "schemaVersion": 37,
  "style": "dark",
  "tags": [
    "loki",
    "logs",
    "generic"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": true,
          "text": "Loki",
          "value": "Loki"
        },
        "datasource": {
          "type": "loki",
          "uid": "gdev-loki"
        },
        "description": null,
        "hide": 0,
        "includeAll": true,
        "label": "Datasource",
        "multi": false,
        "name": "datasource",
        "query": "loki",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {
          "selected": true,
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "loki",
          "uid": "${datasource}"
        },
        "definition": "label_values(job)",
        "description": null,
        "hide": 0,
        "includeAll": true,
        "label": "Job",
        "multi": true,
        "name": "job",
        "query": "label_values(job)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "loki",
          "uid": "${datasource}"
        },
        "definition": "label_values({job=~\"$job\"}, namespace)",
        "description": null,
        "hide": 0,
        "includeAll": true,
        "label": "Namespace",
        "multi": true,
        "name": "namespace",
        "query": "label_values({job=~\"$job\"}, namespace)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": {
          "type": "loki",
          "uid": "${datasource}"
        },
        "definition": "label_values({job=~\"$job\", namespace=~\"$namespace\"}, level)",
        "description": null,
        "hide": 0,
        "includeAll": true,
        "label": "Level",
        "multi": true,
        "name": "level",
        "query": "label_values({job=~\"$job\", namespace=~\"$namespace\"}, level)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "description": "Enter text to search in log lines",
        "hide": 0,
        "label": "Filter Text",
        "name": "filter",
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Generic Loki Log Search",
  "uid": "generic-loki-dashboard",
  "version": 1
}