Commit 06b9b0ae authored by Dimitrios Giannopoulos's avatar Dimitrios Giannopoulos
Browse files

feat: use loki logs

parent c37096a1
Loading
Loading
Loading
Loading
Loading
+59 −462
Original line number Diff line number Diff line
@@ -3,10 +3,7 @@
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "prometheus",
          "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
        },
        "datasource": "${DS_PROMETHEUS}",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
@@ -25,10 +22,7 @@
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
@@ -112,10 +106,7 @@
      "pluginVersion": "10.3.3",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "expr": "sum(irate(container_cpu_usage_seconds_total{pod=~\"$pod\",namespace=\"$namespace\",image!=\"\",container!=\"POD\"}[2m]))",
          "format": "time_series",
          "refId": "A"
@@ -125,10 +116,7 @@
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "datasource": "${DS_LOKI}",
      "description": "Total  Count of log lines in the specified time range",
      "fieldConfig": {
        "defaults": {
@@ -197,11 +185,8 @@
      "pluginVersion": "10.3.3",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", stream=~\"$stream\", pod=~\"$pod\"})[$__interval]))",
          "datasource": "${DS_LOKI}",
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"})[$__interval]))",
          "hide": false,
          "refId": "A"
        }
@@ -210,10 +195,7 @@
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "datasource": "${DS_LOKI}",
      "description": "Total Count: of $searchable_pattern in the specified time range",
      "fieldConfig": {
        "defaults": {
@@ -277,11 +259,8 @@
      "pluginVersion": "10.3.3",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", stream=~\"$stream\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval]))",
          "datasource": "${DS_LOKI}",
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval]))",
          "hide": false,
          "refId": "A"
        }
@@ -290,10 +269,7 @@
      "type": "stat"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "datasource": "${DS_LOKI}",
      "description": "Live logs is a like 'tail -f' in a real time",
      "gridPos": {
        "h": 9,
@@ -314,11 +290,8 @@
      },
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "{namespace=\"$namespace\", pod=~\"$pod\", stream=~\"$stream\"} |~ \"(?i)$searchable_pattern\" ",
          "datasource": "${DS_LOKI}",
          "expr": "{namespace=\"$namespace\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\" ",
          "hide": false,
          "refId": "A"
        }
@@ -331,10 +304,7 @@
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "links": [],
@@ -378,10 +348,7 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "expr": "sum(container_memory_working_set_bytes{pod=~\"$pod\",namespace=\"$namespace\",image!=\"\",container!=\"POD\"})",
          "format": "time_series",
          "refId": "A"
@@ -415,108 +382,6 @@
        "align": false
      }
    },
    {
      "aliasColors": {
        "stderr": "#C4162A",
        "stdout": "#37872D"
      },
      "breakPoint": "50%",
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "color": "#299c46",
                  "text": "0"
                }
              },
              "type": "special"
            }
          ],
          "unit": "none",
          "unitScale": true
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 9,
        "x": 0,
        "y": 30
      },
      "id": 19,
      "legend": {
        "header": "Total Count",
        "percentage": true,
        "percentageDecimals": 2,
        "show": true,
        "sort": "total",
        "sortDesc": true,
        "values": true
      },
      "legendType": "right",
      "links": [],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "showLegend": true
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pieType": "pie",
      "pluginVersion": "7.0.4",
      "strokeWidth": "1.5",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"})[$__interval])) by (stream)",
          "hide": false,
          "refId": "A"
        }
      ],
      "title": "Total count of stderr / stdout pie",
      "type": "piechart",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
@@ -524,10 +389,7 @@
        "label": "Others",
        "threshold": 0
      },
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "datasource": "${DS_LOKI}",
      "decimals": 0,
      "fieldConfig": {
        "defaults": {
@@ -592,11 +454,8 @@
      "strokeWidth": "0.4",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\", stream=~\"$stream\"} |~ \"(?i)$searchable_pattern\")[$__interval])) by (pod)",
          "datasource": "${DS_LOKI}",
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval])) by (pod)",
          "refId": "A"
        }
      ],
@@ -605,10 +464,7 @@
      "valueName": "total"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "datasource": "${DS_LOKI}",
      "fieldConfig": {
        "defaults": {
          "mappings": [
@@ -666,11 +522,8 @@
      "pluginVersion": "10.3.3",
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", stream=~\"$stream\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval])) * 100 / sum(count_over_time(({namespace=\"$namespace\", stream=~\"$stream\", pod=~\"$pod\"})[$__interval]))",
          "datasource": "${DS_LOKI}",
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval])) * 100 / sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"})[$__interval]))",
          "hide": false,
          "refId": "A"
        }
@@ -683,10 +536,7 @@
      "bars": true,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "datasource": "${DS_LOKI}",
      "decimals": 0,
      "fieldConfig": {
        "defaults": {
@@ -698,10 +548,10 @@
      "fill": 1,
      "fillGradient": 1,
      "gridPos": {
        "h": 9,
        "w": 12,
        "h": 7,
        "w": 9,
        "x": 0,
        "y": 37
        "y": 30
      },
      "hiddenSeries": false,
      "id": 18,
@@ -738,11 +588,8 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\", stream=~\"$stream\"} |~ \"(?i)$searchable_pattern\")[$__interval])) by (pod)",
          "datasource": "${DS_LOKI}",
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[$__interval])) by (pod)",
          "refId": "A"
        }
      ],
@@ -785,221 +632,7 @@
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "fieldConfig": {
        "defaults": {
          "links": [],
          "unitScale": true
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 10,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 37
      },
      "hiddenSeries": false,
      "id": 10,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "maxDataPoints": 100,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.3.3",
      "pointradius": 0.5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(rate(({namespace=\"$namespace\", stream=~\"$stream\", pod=~\"$pod\"} |~ \"(?i)$searchable_pattern\")[30s])) by (pod)",
          "hide": false,
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "\"$searchable_pattern\" Rate per Pod",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:2804",
          "format": "short",
          "logBase": 10,
          "show": true
        },
        {
          "$$hashKey": "object:2805",
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "loki",
        "uid": "P8E80F9AEF21F6940"
      },
      "fieldConfig": {
        "defaults": {
          "links": [],
          "unit": "none",
          "unitScale": true
        },
        "overrides": []
      },
      "fill": 2,
      "fillGradient": 4,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 46
      },
      "hiddenSeries": false,
      "id": 7,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "maxDataPoints": 100,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.3.3",
      "pointradius": 2,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:154",
          "alias": "{stream=\"stderr\"} stderr",
          "color": "#C4162A",
          "legend": false,
          "linewidth": 2
        },
        {
          "$$hashKey": "object:220",
          "alias": "{stream=\"stdout\"} stdout",
          "color": "#56A64B",
          "legend": false,
          "linewidth": 2
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "loki",
            "uid": "P8E80F9AEF21F6940"
          },
          "expr": "sum(count_over_time(({namespace=\"$namespace\", pod=~\"$pod\"})[$__interval])) by (stream)",
          "hide": false,
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Count of stderr / stdout historical",
      "tooltip": {
        "shared": true,
        "sort": 2,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:188",
          "format": "none",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:189",
          "format": "short",
          "label": "",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "links": [],
@@ -1046,10 +679,7 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "editorMode": "code",
          "exemplar": true,
          "expr": "sum(irate(container_network_receive_bytes_total{pod=~\"$pod\", namespace=~\"$namespace\"}[5m]))",
@@ -1099,10 +729,7 @@
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "links": [],
@@ -1149,10 +776,7 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "editorMode": "code",
          "exemplar": true,
          "expr": "sum(irate(container_network_transmit_bytes_total{pod=~\"$pod\", namespace=~\"$namespace\"}[5m]))",
@@ -1202,10 +826,7 @@
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "links": [],
@@ -1255,10 +876,7 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "editorMode": "code",
          "expr": "avg(irate(container_cpu_usage_seconds_total{pod=~\"$pod\", namespace=\"$namespace\", image!=\"\", pod!=\"\", container!=\"POD\", container!=\"\"}[2m])) by (pod,container)",
          "format": "time_series",
@@ -1303,10 +921,7 @@
      }
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "color": {
@@ -1392,10 +1007,7 @@
      "pluginVersion": "10.3.3",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "editorMode": "code",
          "exemplar": true,
          "expr": "sum (container_memory_working_set_bytes{pod=~\"$pod$\", namespace=\"$namespace\", image!=\"\", pod!=\"\", container!=\"POD\", container!=\"\"}) by (pod, container)",
@@ -1416,10 +1028,7 @@
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "links": [],
@@ -1464,10 +1073,7 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "editorMode": "code",
          "expr": "avg(irate(container_network_receive_bytes_total{pod=~\"$pod\", namespace=~\"$namespace\"}[5m])) by (pod, container)",
          "format": "time_series",
@@ -1515,10 +1121,7 @@
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
      },
      "datasource": "${DS_PROMETHEUS}",
      "fieldConfig": {
        "defaults": {
          "links": [],
@@ -1563,10 +1166,7 @@
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
          },
          "datasource": "${DS_PROMETHEUS}",
          "editorMode": "code",
          "exemplar": true,
          "expr": "avg(irate(container_network_transmit_bytes_total{pod=~\"$pod\", namespace=~\"$namespace\"}[5m])) by (pod, container)",
@@ -1622,10 +1222,7 @@
          "text": "monitoring",
          "value": "monitoring"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
        },
        "datasource": "${DS_PROMETHEUS}",
        "definition": "",
        "hide": 0,
        "includeAll": true,
@@ -1645,10 +1242,7 @@
          "text": "All",
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "fe5aa271-2586-46ed-9d19-73cf8e39f3f7"
        },
        "datasource": "${DS_PROMETHEUS}",
        "definition": "",
        "hide": 0,
        "includeAll": true,
@@ -1662,21 +1256,6 @@
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": ".*",
          "value": ".*"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "stream",
        "options": [],
        "query": ".*",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": false,
@@ -1726,5 +1305,23 @@
  "title": "Pods + Logs Dashboard",
  "uid": "-pods-logs-dashboard",
  "version": 13,
  "weekStart": ""
  "weekStart": "",
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    },
    {
      "name": "DS_LOKI",
      "label": "Loki",
      "description": "",
      "type": "datasource",
      "pluginId": "loki",
      "pluginName": "Loki"
    }
  ]
}
 No newline at end of file