如何在 LogsGroup CloudWatch 中保存 Athena 执行的查询

How to save queries executed by Athena in LogsGroup CloudWatch

我想将 Athena 执行的请求保存在 CloudWatch 服务的一个 LogsGroup 中。

在 CloudWatch 中,我创建了这条规则:

{
  "source": [
    "aws.athena"
  ],
  "detail-type": [
    "Athena Query State Change"
  ],
  "detail": {
    "currentState": [
      "QUEUED",
      "RUNNING",
      "SUCCEEDED",
      "FAILED",
      "CANCELLED"
    ]
  }
}

并且,我将规则附加到 CloudWatch LogsGroup,如下所示:

LogsGroup

我设法在 CloudWatch -> 日志组 -> /aws/events/TestAthena 中注册日志,但我没有我想要的信息:

{
    "version": "0",
    "id": "a8bad43b-1b9a-da7e-c004-f3c920e1bddd",
    "detail-type": "Athena Query State Change",
    "source": "aws.athena",
    "account": "<account_id>",
    "time": "2021-08-23T15:54:13Z",
    "region": "eu-west-3",
    "resources": [],
    "detail": {
        "currentState": "RUNNING",
        "previousState": "QUEUED",
        "queryExecutionId": "b0fe7373-676d-43d5-b866-19d701c9dc56",
        "sequenceNumber": "2",
        "statementType": "DML",
        "versionId": "0",
        "workgroupName": "dev-Connect-CardBulk"
    }
}

我希望拥有:

可以用 CloudWatch 实现吗?

提前感谢您的帮助,

开箱即用,您可以拥有 QueryPlanningTime、QueryQueuetime 等指标。 尽管如此,您还是需要 Cloudtrail 来跟踪执行者。

参考这些链接:

List of CloudWatch Metrics and Dimensions for Athena

Monitoring Amazon Athena Queries using Amazon CloudWatch