Grafana サンプルダッシュボード コンテナログ (Azure Monitor)¶
使用しているベンダーが Azure の場合に使用する Azure Monitor に収集されたコンテナログデータを表示するサンプルダッシュボードです。
ダッシュボードの使用方法¶
本ダッシュボードを使用することで、コンテナログデータを表示することができます。
画面上部の Resource Groups
にて Kubernetes クラスタが構築されているリソースグループを選択します。
次に Cluster Name
から リソースグループ内に構築されているクラスタを選択することで、
クラスタ内のコンテナログデータを表示することができます。
また、 Pod Name
にて Pod 名による部分一致の検索を行うことができます。
コードブロック右上のコピーボタンからコピーしてお使いください。
{
"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": 13,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"gridPos": {
"h": 10,
"w": 22,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"targets": [
{
"azureLogAnalytics": {
"query": "let startDateTime = $__timeFrom;\nlet endDateTime = $__timeTo;\nlet podName = \"$podname\";\nlet PodNameTable = KubePodInventory\n | where TimeGenerated between (startDateTime .. endDateTime)\n | where Name has podName\n | extend PodName = Name\n | distinct PodName,ContainerID;\nlet CotainerLogTable = ContainerLog\n | where TimeGenerated between (startDateTime .. endDateTime);\nPodNameTable\n | join hint.strategy=shuffle kind=inner CotainerLogTable on ContainerID\n | project-away ContainerID1\n | sort by TimeGenerated\n | limit 30000",
"resource": "/subscriptions/$sub/resourceGroups/$rg/providers/Microsoft.ContainerService/managedClusters/$clsname",
"resultFormat": "table"
},
"azureMonitor": {
"allowedTimeGrainsMs": [],
"timeGrain": "auto"
},
"datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"queryType": "Azure Log Analytics",
"refId": "A"
}
],
"title": "Container Log",
"type": "logs"
}
],
"refresh": "",
"revision": 1,
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "Azure Monitor",
"value": "Azure Monitor"
},
"hide": 2,
"includeAll": false,
"label": "DataSource",
"multi": false,
"name": "ds",
"options": [],
"query": "grafana-azure-monitor-datasource",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
"current": {
},
"datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"definition": "",
"hide": 0,
"includeAll": false,
"label": "Subscription",
"multi": false,
"name": "sub",
"options": [],
"query": {
"azureLogAnalytics": {
"query": "",
"resource": ""
},
"queryType": "Azure Subscriptions",
"refId": "A"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": "",
"current": {
},
"datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"definition": "",
"hide": 0,
"includeAll": false,
"label": "Resource Group(s)",
"multi": false,
"name": "rg",
"options": [],
"query": {
"azureLogAnalytics": {
"query": "",
"resource": ""
},
"queryType": "Azure Resource Groups",
"refId": "A",
"subscription": "$sub"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false,
"text": "None",
"value": ""
},
"datasource": {
"type": "grafana-azure-monitor-datasource",
"uid": "${ds}"
},
"definition": "",
"hide": 0,
"includeAll": false,
"label": "Cluster Name",
"multi": false,
"name": "clsname",
"options": [],
"query": {
"azureLogAnalytics": {
"query": "",
"resource": ""
},
"namespace": "microsoft.containerservice/managedclusters",
"queryType": "Azure Resource Names",
"refId": "A",
"resourceGroup": "$rg",
"subscription": "$sub"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false,
"text": "",
"value": ""
},
"hide": 0,
"label": "Pod Name",
"name": "podname",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"skipUrlSync": false,
"type": "textbox"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"hidden": false,
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Azure Monitor Container Log",
"uid": "_vtvQjf4z",
"version": 4,
"weekStart": ""
}