Skip to content

Instantly share code, notes, and snippets.

@Condla
Created November 13, 2023 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Condla/cb57fc87088074be7bb9f3ad2b300dec to your computer and use it in GitHub Desktop.
Save Condla/cb57fc87088074be7bb9f3ad2b300dec to your computer and use it in GitHub Desktop.
Audit Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 37,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 0
},
"id": 25,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"content": "# Grafana Cloud Usage Overview\n\nThis dashboard gives an overview about the activities performed by the indivudal users. In the users tab, you'll see\n\n* number of users who are active in the timeframe chosen by the time picker above\n* most active users by id on a pie chart\n* all active users sorted by id to correlate to their user names\n\nTo make use of this dashboard you can search for certain users, and/or click on them in the user mapping or the pie chart; or directly enter the user id in the text field on the top\n\nThen you will see the user specific information, e.g. when they were active, when they logged in/out or which datasources they have been using.",
"mode": "markdown"
},
"pluginVersion": "10.3.0-63137",
"type": "text"
},
{
"collapsed": true,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 7
},
"id": 5,
"panels": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 8
},
"id": 22,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "right",
"showLegend": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.2.0-61719",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "topk(400,sum by(user_userId, user_username) (count_over_time({kind=\"auditing\"} != \"liamoddell1\" != \"stefandunkler\" |= `$filter` | json | user_userId != `` | user_username != `` [$__auto])))",
"legendFormat": "{{user_username}}",
"queryType": "range",
"refId": "A"
}
],
"title": "User Activity",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": false,
"user_username": false
},
"indexByName": {},
"renameByName": {
"Value #A": "Requests",
"user_userId": "User ID",
"user_username": "Username"
}
}
}
],
"type": "timeseries"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 70
},
{
"color": "red",
"value": 85
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 3,
"x": 0,
"y": 12
},
"id": 17,
"options": {
"minVizHeight": 75,
"minVizWidth": 75,
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": false
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "count(sum by(user_userId) (count_over_time({kind=\"auditing\"} != \"liamoddell1\" != \"stefandunkler\" |=`$filter` | json | user_userId != `` [$__auto])))",
"legendFormat": "{{user_name}}",
"queryType": "instant",
"refId": "A"
}
],
"title": "Number of Active Users",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": false
},
"indexByName": {},
"renameByName": {}
}
}
],
"type": "gauge"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"links": [
{
"title": "",
"url": "/d/fa37362e-e4de-45b8-ab22-5f2393fd270e/audit?orgId=1&var-userId=${__data.fields.user_userId}"
}
],
"mappings": []
},
"overrides": [
{
"__systemRef": "hideSeriesFrom",
"matcher": {
"id": "byNames",
"options": {
"mode": "exclude",
"names": [
"Value #A"
],
"prefix": "All except:",
"readOnly": true
}
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 8,
"x": 3,
"y": 12
},
"id": 1,
"options": {
"displayLabels": [
"percent"
],
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true,
"values": [
"percent"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "topk(20,sum by(user_userId) (count_over_time({kind=\"auditing\"} |=`$filter` | json | user_userId != `` [$__auto])))",
"legendFormat": "{{user_name}}",
"queryType": "instant",
"refId": "A"
}
],
"title": "20 most active users",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {},
"renameByName": {}
}
}
],
"type": "piechart"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"links": [
{
"title": "",
"url": "/d/fa37362e-e4de-45b8-ab22-5f2393fd270e/audit?orgId=1&var-userId=${__data.fields[\"User ID\"]}&from=${__from}&to=now"
}
],
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "User ID"
},
"properties": [
{
"id": "custom.width",
"value": 143
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 13,
"x": 11,
"y": 12
},
"id": 7,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": false,
"displayName": "User ID"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "topk(400,sum by(user_userId, user_username) (count_over_time({kind=\"auditing\"} |= `$filter` | json | user_userId != `` | user_username != `` [$__auto])))",
"queryType": "instant",
"refId": "A"
}
],
"title": "User ID - Username Mapping",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value #A": true,
"user_username": false
},
"indexByName": {
"Time": 0,
"Value #A": 3,
"user_userId": 1,
"user_username": 2
},
"renameByName": {
"Value #A": "Requests",
"user_userId": "User ID",
"user_username": "Username"
}
}
},
{
"id": "convertFieldType",
"options": {
"conversions": [
{
"destinationType": "number",
"targetField": "User ID"
}
],
"fields": {}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 21
},
"id": 12,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Frequency"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "builder",
"expr": "sum by(action) (count_over_time({kind=\"auditing\"} |= `` | json [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Performed Actions",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {},
"renameByName": {
"Value #A": "Frequency",
"action": "Action"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 21
},
"id": 13,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"pluginVersion": "10.2.0-61719",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "builder",
"expr": "{kind=\"auditing\"} |= `$filter` | json",
"queryType": "range",
"refId": "A"
}
],
"title": "Detailed Logs",
"transformations": [],
"type": "logs"
}
],
"title": "Users",
"type": "row"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 8
},
"id": 6,
"panels": [],
"title": "by User",
"type": "row"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"description": "",
"gridPos": {
"h": 2,
"w": 24,
"x": 0,
"y": 9
},
"id": 24,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"content": "### Please choose a user id above to show user specific data below",
"mode": "markdown"
},
"pluginVersion": "10.3.0-63137",
"type": "text"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 11
},
"id": 23,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "right",
"showLegend": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.2.0-61719",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "topk(400,sum by(user_userId, user_username) (count_over_time({kind=\"auditing\"} != \"liamoddell1\" != \"stefandunkler\" |= `$filter` | json | user_userId != `` | user_userId =~ `$userId` [$__auto])))",
"queryType": "range",
"refId": "A"
}
],
"title": "User Activity",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": false,
"user_username": false
},
"indexByName": {},
"renameByName": {
"Value #A": "Requests",
"user_userId": "User ID",
"user_username": "Username"
}
}
}
],
"type": "timeseries"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-RdYlGr"
},
"custom": {
"fillOpacity": 70,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineWidth": 0,
"spanNulls": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 24,
"x": 0,
"y": 15
},
"id": 16,
"options": {
"alignValue": "left",
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"mergeValues": true,
"rowHeight": 0.9,
"showValue": "auto",
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "sum by(user_userId) (count_over_time({kind=\"auditing\"} |= `login` | json | user_userId != `` | user_userId =~ \"$userId\" [$__auto]))",
"legendFormat": "{{user_userId}}",
"queryType": "range",
"refId": "A"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "sum by(user_userId) (count_over_time({kind=\"auditing\"} |= `logout` | json | user_userId =~ \"$userId\" [$__auto]))",
"hide": false,
"legendFormat": "{{user_userId}}",
"queryType": "range",
"refId": "B"
}
],
"title": "Logins and Logouts",
"type": "state-timeline"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "userId"
},
"properties": [
{
"id": "custom.width",
"value": 115
}
]
},
{
"matcher": {
"id": "byName",
"options": "datasourceType"
},
"properties": [
{
"id": "custom.width",
"value": 192
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
}
]
},
"gridPos": {
"h": 16,
"w": 12,
"x": 0,
"y": 20
},
"id": 18,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Amount"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"editorMode": "code",
"expr": "sum by(userId, datasourceType, source) (count_over_time({instance_type=\"grafana\"} |= `` | logfmt | userId =~ \"$userId\" [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Most Frequent Queries",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"Value #A": 4,
"datasourceType": 2,
"source": 3,
"userId": 1
},
"renameByName": {
"Value #A": "Amount",
"datasourceType": "Datasource Type",
"source": "Source",
"userId": "User ID"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "userId"
},
"properties": [
{
"id": "custom.width",
"value": 115
}
]
},
{
"matcher": {
"id": "byName",
"options": "datasourceType"
},
"properties": [
{
"id": "custom.width",
"value": 192
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
}
]
},
"gridPos": {
"h": 5,
"w": 12,
"x": 12,
"y": 20
},
"id": 19,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Amount"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"editorMode": "code",
"expr": "sum by(userId, datasourceType, source) (count_over_time({instance_type=\"grafana\"} |= `` | logfmt | userId =~ \"$userId\" | datasourceType = \"tempo\" [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Most Frequent Trace Queries",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"Value #A": 4,
"datasourceType": 2,
"source": 3,
"userId": 1
},
"renameByName": {
"Value #A": "Amount",
"datasourceType": "Datasource Type",
"source": "Source",
"userId": "User ID"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "userId"
},
"properties": [
{
"id": "custom.width",
"value": 115
}
]
},
{
"matcher": {
"id": "byName",
"options": "datasourceType"
},
"properties": [
{
"id": "custom.width",
"value": 192
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
}
]
},
"gridPos": {
"h": 5,
"w": 12,
"x": 12,
"y": 25
},
"id": 20,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Amount"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"editorMode": "code",
"expr": "sum by(userId, datasourceType, source) (count_over_time({instance_type=\"grafana\"} |= `` | logfmt | userId =~ \"$userId\" | datasourceType = \"loki\" [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Most Frequent Logs Queries",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"Value #A": 4,
"datasourceType": 2,
"source": 3,
"userId": 1
},
"renameByName": {
"Value #A": "Amount",
"datasourceType": "Datasource Type",
"source": "Source",
"userId": "User ID"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "userId"
},
"properties": [
{
"id": "custom.width",
"value": 115
}
]
},
{
"matcher": {
"id": "byName",
"options": "datasourceType"
},
"properties": [
{
"id": "custom.width",
"value": 192
}
]
},
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 12,
"x": 12,
"y": 30
},
"id": 21,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Amount"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-usage-insights"
},
"editorMode": "code",
"expr": "sum by(userId, datasourceType, source) (count_over_time({instance_type=\"grafana\"} |= `` | logfmt | userId =~ \"$userId\" | datasourceType = \"prometheus\" [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Most Frequent Metrics Queries",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {
"Time": 0,
"Value #A": 4,
"datasourceType": 2,
"source": 3,
"userId": 1
},
"renameByName": {
"Value #A": "Amount",
"datasourceType": "Datasource Type",
"source": "Source",
"userId": "User ID"
}
}
}
],
"type": "table"
},
{
"collapsed": true,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 36
},
"id": 11,
"panels": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-BlPu"
},
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Value #A"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "gauge"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 10
},
"id": 10,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Frequency"
}
]
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "builder",
"expr": "sum by(action) (count_over_time({kind=\"auditing\"} |= `` | json [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Performed Actions",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true
},
"indexByName": {},
"renameByName": {
"Value #A": "Frequency",
"action": "Action"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 0
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 3,
"x": 0,
"y": 17
},
"id": 4,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "10.3.0-63137",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "builder",
"expr": "sum by(result_statusType) (count_over_time({kind=\"auditing\"} |= `` | json | result_statusType !~ `|success` [$__auto]))",
"queryType": "instant",
"refId": "A"
}
],
"title": "Failing Requests",
"type": "stat"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"gridPos": {
"h": 7,
"w": 21,
"x": 3,
"y": 17
},
"id": 9,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"pluginVersion": "10.2.0-61719",
"targets": [
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"editorMode": "code",
"expr": "{kind=\"auditing\"} |= `` | json | result_statusType !~ `success`",
"queryType": "range",
"refId": "A"
}
],
"title": "Failing Requests",
"type": "logs"
}
],
"title": "Details and Failures",
"type": "row"
}
],
"refresh": "",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "",
"value": ""
},
"hide": 0,
"name": "filter",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"skipUrlSync": false,
"type": "textbox"
},
{
"datasource": {
"type": "loki",
"uid": "grafanacloud-logs"
},
"filters": [],
"hide": 0,
"name": "Filters",
"skipUrlSync": false,
"type": "adhoc"
},
{
"current": {
"selected": false,
"text": "15",
"value": "15"
},
"hide": 0,
"label": "User ID",
"name": "userId",
"options": [
{
"selected": false,
"text": ".*",
"value": ".*"
}
],
"query": "15",
"skipUrlSync": false,
"type": "textbox"
}
]
},
"time": {
"from": "now-7d",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Audit",
"uid": "fa37362e-e4de-45b8-ab22-5f2393fd270e",
"version": 44,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment