Grafana dashboard: Custom PostgreSQL Logging
Description: Custom PostgreSQL Logging for a school project.

PostgreSQL dashboard for a school project.

{
  "__inputs": [
    {
      "name": "DS_POSTGRESQL",
      "label": "PostgreSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.2"
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "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": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_POSTGRESQL}"
      },
      "description": "\n",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 7,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "value_and_name"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL}"
          },
          "editorMode": "builder",
          "format": "table",
          "hide": false,
          "rawSql": "SELECT COUNT(\"Id\") AS \"Amount of orders\" FROM \"Order\" LIMIT 50 ",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "alias": "\"Amount of orders\"",
                "name": "COUNT",
                "parameters": [
                  {
                    "name": "\"Id\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          },
          "table": "\"Order\""
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL}"
          },
          "editorMode": "builder",
          "format": "table",
          "hide": false,
          "rawSql": "SELECT COUNT(\"Id\") AS \"Amount of users\" FROM \"User\" LIMIT 50 ",
          "refId": "B",
          "sql": {
            "columns": [
              {
                "alias": "\"Amount of users\"",
                "name": "COUNT",
                "parameters": [
                  {
                    "name": "\"Id\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          },
          "table": "\"User\""
        },
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL}"
          },
          "editorMode": "builder",
          "format": "table",
          "hide": false,
          "rawSql": "SELECT COUNT(\"Id\") AS \"Amount of products\" FROM \"Product\" LIMIT 50 ",
          "refId": "C",
          "sql": {
            "columns": [
              {
                "alias": "\"Amount of products\"",
                "name": "COUNT",
                "parameters": [
                  {
                    "name": "\"Id\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          },
          "table": "\"Product\""
        }
      ],
      "title": "Database Totals",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_POSTGRESQL}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "State"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 60
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 7,
        "y": 0
      },
      "id": 6,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL}"
          },
          "editorMode": "builder",
          "format": "table",
          "hide": false,
          "rawSql": "SELECT \"State\", COUNT(\"State\") AS \"aantal\" FROM \"TrackState\" GROUP BY \"State\" LIMIT 50 ",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  {
                    "name": "\"State\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              },
              {
                "alias": "\"aantal\"",
                "name": "COUNT",
                "parameters": [
                  {
                    "name": "\"State\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "name": "\"State\"",
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50,
            "whereJsonTree": {
              "children1": [
                {
                  "id": "a8a8baba-cdef-4012-b456-7185377514a1",
                  "properties": {
                    "value": [],
                    "valueSrc": []
                  },
                  "type": "rule"
                }
              ],
              "id": "89bba88a-89ab-4cde-b012-31853754f059",
              "type": "group"
            }
          },
          "table": "\"TrackState\""
        }
      ],
      "title": "Order statusses",
      "type": "table"
    },
    {
      "datasource": {
        "type": "postgres",
        "uid": "${DS_POSTGRESQL}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Id"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 49
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 22,
        "w": 7,
        "x": 0,
        "y": 4
      },
      "id": 4,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "postgres",
            "uid": "${DS_POSTGRESQL}"
          },
          "editorMode": "builder",
          "format": "table",
          "rawSql": "SELECT \"Id\", \"Message\" AS \"Feedback\" FROM \"UserFeedback\" LIMIT 50 ",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [
                  {
                    "name": "\"Id\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              },
              {
                "alias": "\"Feedback\"",
                "parameters": [
                  {
                    "name": "\"Message\"",
                    "type": "functionParameter"
                  }
                ],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50,
            "whereJsonTree": {
              "children1": [
                {
                  "id": "b8aa8b88-0123-4456-b89a-b185376bf29f",
                  "properties": {
                    "value": [],
                    "valueSrc": []
                  },
                  "type": "rule"
                }
              ],
              "id": "89bba88a-89ab-4cde-b012-31853754f059",
              "type": "group"
            }
          },
          "table": "\"UserFeedback\""
        }
      ],
      "title": "Recent feedback",
      "type": "table"
    }
  ],
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Custom PostgreSQL Logging",
  "uid": "2AeBhq5Vk",
  "version": 4,
  "weekStart": "",
  "gnetId": 17695,
  "description": "Custom PostgreSQL Logging for a school project."
}