Skip to content

Instantly share code, notes, and snippets.

@kadoshita
Last active March 17, 2022 10:29
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 kadoshita/fcda0cff88135f953be1aa64bb998a30 to your computer and use it in GitHub Desktop.
Save kadoshita/fcda0cff88135f953be1aa64bb998a30 to your computer and use it in GitHub Desktop.
  1. 新しいPanelを追加し、可視化方法をTableにする
  2. Inspect → Panel JSON でJSONの設定画面を開く

image

  1. Top_Slow_Endpoint.jsonの内容を貼り付ける
  2. DatasourceのID <Your Datasource ID> を自分の環境のものに置き換える
  3. アクセスログのファイル名 <Your Logfile Name> を自分の環境のものに置き換える

動作確認環境

  • Grafana v8.3.4 (a551d74b11)
{
"id": 2,
"gridPos": {
"h": 29,
"w": 11,
"x": 0,
"y": 0
},
"type": "table",
"title": "Panel Title",
"transformations": [
{
"id": "labelsToFields",
"options": {}
},
{
"id": "merge",
"options": {}
},
{
"id": "sortBy",
"options": {
"fields": {},
"sort": [
{
"field": "request_time",
"desc": true
}
]
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value": true,
"body_bytes_send": true,
"country": true,
"filename": true,
"forwardedfor": true,
"id": true,
"job": true,
"line": true,
"referer": true,
"remote_addr": true,
"remote_port": true,
"server_protocol": true,
"time": true,
"ts": true,
"tsNs": true,
"useragent": true
},
"indexByName": {
"body_bytes_send": 12,
"country": 14,
"filename": 10,
"forwardedfor": 11,
"id": 17,
"job": 7,
"line": 16,
"referer": 8,
"remote_addr": 9,
"remote_port": 15,
"request_method": 1,
"request_time": 5,
"request_uri": 2,
"server_protocol": 3,
"status": 4,
"time": 0,
"ts": 6,
"tsNs": 18,
"useragent": 13
},
"renameByName": {}
}
}
],
"datasource": {
"type": "loki",
"uid": "Q-v4kTI7z"
},
"pluginVersion": "8.3.4",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"displayMode": "auto"
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"mappings": [],
"color": {
"mode": "thresholds"
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "request_time"
},
"properties": [
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 0.5
},
{
"color": "red",
"value": 1
}
]
}
},
{
"id": "custom.displayMode",
"value": "color-text"
}
]
},
{
"matcher": {
"id": "byName",
"options": "request_uri"
},
"properties": [
{
"id": "custom.minWidth",
"value": 600
}
]
},
{
"matcher": {
"id": "byName",
"options": "time"
},
"properties": [
{
"id": "custom.width",
"value": 267
}
]
},
{
"matcher": {
"id": "byName",
"options": "status"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-text"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 400
},
{
"color": "red",
"value": 500
}
]
}
}
]
}
]
},
"options": {
"showHeader": true,
"footer": {
"show": false,
"reducer": [
"sum"
],
"fields": ""
}
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "<Your Datasource ID>"
},
"expr": "{filename=\"<Your Logfile Name>\"}",
"refId": "A"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment