Grafana サンプルダッシュボード コンテナログ (Amazon CloudWatch Logs)

使用しているベンダーが AWS の場合に使用する Amazon CloudWatch Logs に収集されたコンテナログデータを表示するサンプルダッシュボードです。

ダッシュボードの使用方法

本ダッシュボードを使用することで、コンテナログデータを表示することができます。

Cluster Name にてクラスタ名を入力することで、クラスタ内のコンテナログデータを表示することができます。 また、 Pod Name にて Pod 名による部分一致の検索を行うことができます。

コードブロック右上のコピーボタンからコピーしてお使いください。

{
  "__inputs": [
    {
      "name": "DS_CLOUDWATCH",
      "label": "cloudwatch",
      "description": "",
      "type": "datasource",
      "pluginId": "cloudwatch",
      "pluginName": "CloudWatch"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "datasource",
      "id": "cloudwatch",
      "name": "CloudWatch",
      "version": "1.0.0"
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.4.7"
    },
    {
      "type": "panel",
      "id": "logs",
      "name": "Logs",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "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": "cloudwatch",
        "uid": "${DS_CLOUDWATCH}"
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "dedupStrategy": "none",
        "enableLogDetails": true,
        "prettifyLogMessage": false,
        "showCommonLabels": false,
        "showLabels": false,
        "showTime": false,
        "sortOrder": "Descending",
        "wrapLogMessage": false
      },
      "targets": [
        {
          "datasource": {
            "type": "cloudwatch",
            "uid": "${DS_CLOUDWATCH}"
          },
          "dimensions": {},
          "expression": "fields @timestamp, @message, @logStream, @log\n| sort @timestamp desc\n| filter kubernetes.pod_name like /${pod}/\n| limit 100",
          "id": "",
          "label": "",
          "logGroups": [
            {
              "arn": "/aws/containerinsights/${cluster}/application",
              "name": "/aws/containerinsights/${cluster}/application"
            }
          ],
          "matchExact": true,
          "metricEditorMode": 0,
          "metricName": "",
          "metricQueryType": 0,
          "namespace": "",
          "period": "",
          "queryMode": "Logs",
          "refId": "A",
          "region": "default",
          "sqlExpression": "",
          "statistic": "Average",
          "statsGroups": []
        }
      ],
      "title": "Amazon CloudWatch Logs",
      "transformations": [],
      "type": "logs"
    }
  ],
  "refresh": "",
  "revision": 1,
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "hide": 0,
        "label": "Cluster",
        "name": "cluster",
        "options": [
          {
            "selected": true,
            "text": "managed-cluster",
            "value": "managed-cluster"
          }
        ],
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "hide": 0,
        "label": "Pod",
        "name": "pod",
        "options": [
          {
            "selected": true,
            "text": "",
            "value": ""
          }
        ],
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      }
    ]
  },
  "time": {
    "from": "now-30m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Amazon CloudWatch Logs",
  "version": 5,
  "weekStart": ""
}