Skip to content

CloudWatch Log Group How to retrieve total count of queries

0

Hello, Is there a way to retrieve the total count of queries executed against a specific CloudWatch Logs log group since the log group's creation or for a custom date range (e.g., past 30 days, past 90 days, etc.)?

I can't seem to find a definite answer on the 'number of queries' metric in CloudWatch Logs. I'm looking for a way to get the query count over a different, user-defined time range, either since the log group's inception or for a specific date range in the past.

If this is possible, could you please provide a link to the documentation? Any guidance or best practices for retrieving and analyzing query statistics would be greatly appreciated.

1 Answer
3
Accepted Answer

Hi

For this you will have to leverage CloudTrail logs.

Any query that is executed, will have a corresponding StartQuery call logged in CloudTrail logs.

You can then use Athena to query through the CloudTrail logs to get these details using SQL-like queries specifying the EventName as StartQuery and EventTime as per your timestamps, along with any other filtering criteria you may have.

Some references: https://repost.aws/knowledge-center/athena-tables-search-cloudtrail-logs https://docs.aws.amazon.com/athena/latest/ug/cloudtrail-logs.html

AWS
EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.