How to get user's Last active time programmatically?

Hi, we can see the last active time under Manage users console, my questions is if there is a way to get this information from API or AWS CLI? I tried describe_user, but it didn’t include the time.

Thanks,
Jiaye

2 Likes

Hi @Jiaye_Liu -

I don’t believe you can do this using the QuickSight API. You could use Cloudtrail to grab the events (API, logs, queries) and then aggregate to produce a pseudo last active time.

CLI example:

aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventSource,AttributeValue=quicksight.amazonaws.com AttributeKey=EventName,AttributeValue=GetDashboard --max-results 1
1 Like

I’m afraid this is not the best alternative, as according to the AWS API documentation itself, it is only possible to use a single filter in --lookup-attributes (documentation). A possible alternative is to create a trail in CloudTrail to dump the logs into an S3 bucket and perform queries via AWS Athena, for example. In addition to being able to query more efficiently, you can have a longer history, as history in CloudTrail only provides access to logs from the last 90 days.

Hello, is this solution still valid?
Is there no way to consult it directly?
From the web console I can see it in a column, there is no way to consult it programmatically?

I’m here to second the value of being able to get this value programmatically. It’s a bit odd that it is available in the QuickSight UI but not the CLI. If this could be added that would be extremely helpful