[Redshift] How to get number of queries executed by each IAM account

0

Hi, I am trying to get the number of queries executed against Redshift but I found it very difficult to find it for each IAM user in our organization.

The problem is that most of the queries on Redshift are executed under the master user(awsuser) and the system tables only shows the count for the master user, not for each individual IAM user.

I have looked all the Redshift system tables and checked cloudtrail/cloudwatch logs. But it seems like I am stuck.

One more question. On CloudTrail event history, whenever I execute a query using redshift query editor v2, I can see several "DriverExecute" events coming up at once. Is there anyother event that I should target to get the number of queries executed by each IAM user?

Thanks

Seung
已提問 7 個月前檢視次數 268 次
1 個回答
1

To get the number of queries executed by each IAM account in Amazon Redshift, you can query the STL_QUERY table. This table contains information about queries, including the user ID of the account that executed the query. By using the STL_QUERY table, you can track the number of queries executed by each IAM account. Here is an example SQL query to retrieve the number of queries executed by each IAM account:

SELECT userid, COUNT(*) AS num_queries FROM stl_query GROUP BY userid;

This query will provide the count of queries executed by each IAM account.

profile pictureAWS
已回答 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南