Grafana dashboard: App Logs
Description: Dashboard for visualising logs collected with the .NET Core library for monitoring

[https://github.com/gerrkoff/monitoring](https://github.com/gerrkoff/monitoring)

{
  "__inputs": [
    {
      "name": "DS_GRAFANACLOUD-GERRKOFF-LOGS",
      "label": "logs",
      "description": "",
      "type": "datasource",
      "pluginId": "loki",
      "pluginName": "Loki"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "barchart",
      "name": "Bar chart",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.2.3-046dbf9789"
    },
    {
      "type": "panel",
      "id": "logs",
      "name": "Logs",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "loki",
      "name": "Loki",
      "version": "1.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": false,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "fillOpacity": 80,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "error"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "info"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "debug"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "trace"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-blue",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "warning"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "orange",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "critical"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-purple",
                  "mode": "fixed"
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 3,
      "interval": "1m",
      "options": {
        "barRadius": 0,
        "barWidth": 0.9,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "orientation": "vertical",
        "showValue": "auto",
        "stacking": "normal",
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        },
        "xField": "Time",
        "xTickLabelRotation": 0,
        "xTickLabelSpacing": 100
      },
      "pluginVersion": "9.2.2-eb6f0ffe76",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
          },
          "editorMode": "code",
          "expr": "sum(count_over_time({app=~\"$app\",env=~\"$env\",inst=~\"$inst\"} | json | level=~\"$level\" | RequestPath!~\"$ignorerequests\" |~ \"$search\" [$__interval])) by (level)",
          "legendFormat": "{{level}}",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
      },
      "gridPos": {
        "h": 17,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 2,
      "options": {
        "dedupStrategy": "none",
        "enableLogDetails": true,
        "prettifyLogMessage": false,
        "showCommonLabels": false,
        "showLabels": false,
        "showTime": true,
        "sortOrder": "Descending",
        "wrapLogMessage": false
      },
      "pluginVersion": "9.2.2-eb6f0ffe76",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
          },
          "editorMode": "code",
          "expr": "{app=~\"$app\",env=~\"$env\",inst=~\"$inst\"} | json | level=~\"$level\" | RequestPath!~\"$ignorerequests\" |~ \"$search\" | line_format \"[{{.env}}][{{.app}}] {{.Message}}\"",
          "legendFormat": "",
          "queryType": "range",
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": true,
                "field": "Time"
              }
            ]
          }
        },
        {
          "id": "limit",
          "options": {
            "limitField": 500
          }
        }
      ],
      "type": "logs"
    }
  ],
  "refresh": "1m",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "loki",
          "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
        },
        "definition": "",
        "hide": 0,
        "includeAll": false,
        "label": "",
        "multi": true,
        "name": "app",
        "options": [],
        "query": {
          "label": "app",
          "refId": "LokiVariableQueryEditor-VariableQuery",
          "stream": "",
          "type": 1
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "loki",
          "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
        },
        "definition": "",
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "env",
        "options": [],
        "query": {
          "label": "env",
          "refId": "LokiVariableQueryEditor-VariableQuery",
          "stream": "",
          "type": 1
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {},
        "datasource": {
          "type": "loki",
          "uid": "${DS_GRAFANACLOUD-GERRKOFF-LOGS}"
        },
        "definition": "",
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "inst",
        "options": [],
        "query": {
          "label": "inst",
          "refId": "LokiVariableQueryEditor-VariableQuery",
          "stream": "",
          "type": 1
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": [
            "critical",
            "error",
            "warning",
            "info",
            "debug",
            "trace"
          ],
          "value": [
            "critical",
            "error",
            "warning",
            "info",
            "debug",
            "trace"
          ]
        },
        "hide": 0,
        "includeAll": false,
        "multi": true,
        "name": "level",
        "options": [
          {
            "selected": true,
            "text": "critical",
            "value": "critical"
          },
          {
            "selected": true,
            "text": "error",
            "value": "error"
          },
          {
            "selected": true,
            "text": "warning",
            "value": "warning"
          },
          {
            "selected": true,
            "text": "info",
            "value": "info"
          },
          {
            "selected": true,
            "text": "debug",
            "value": "debug"
          },
          {
            "selected": true,
            "text": "trace",
            "value": "trace"
          }
        ],
        "query": "critical,error,warning,info,debug,trace",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "hide": 0,
        "name": "search",
        "options": [
          {
            "selected": true,
            "text": "",
            "value": ""
          }
        ],
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": false,
          "text": "/metrics",
          "value": "/metrics"
        },
        "hide": 0,
        "label": "ignore requests",
        "name": "ignorerequests",
        "options": [
          {
            "selected": true,
            "text": "/metrics",
            "value": "/metrics"
          }
        ],
        "query": "/metrics",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "App Logs",
  "uid": "--1B5sN4k",
  "version": 18,
  "weekStart": "",
  "gnetId": 17328,
  "description": "Dashboard for visualising logs collected with the .NET Core library for monitoring"
}