Mitsukk
Mitsukk

Reputation: 321

How to save queries executed by Athena in LogsGroup CloudWatch

I want to save the requests executed by Athena in a LogsGroup of the CloudWatch service.

In CloudWatch, I created this rule:

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

And, I attached the rule to a CloudWatch LogsGroup like this:

LogsGroup

I managed to register logs in CloudWatch -> Log groups -> /aws/events/TestAthena but I don't have the information I want:

{
    "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"
    }
}

I wish to have :

It is possible to have this with CloudWatch ?

Thank you in advance for your help,

Upvotes: 1

Views: 647

Answers (1)

Ash
Ash

Reputation: 1466

Out of the box, you can have QueryPlanningTime, QueryQueuetime etc. metrics. Nonetheless, you need Cloudtrail to track who executed.

Refer to these links:

List of CloudWatch Metrics and Dimensions for Athena

Monitoring Amazon Athena Queries using Amazon CloudWatch

Upvotes: 1

Related Questions