Metrics of AWS Cognito show number of SignIns on whole userpool. Is it possible to get number of SignIns by user group inside the pool?
Or number of SignIns by one specific user.
I tried to find something in doc and found nothing, but may be it have some workaround or I missed something.
2
Answers
In order to achieve this, take a param in the event from the frontend.Take a hardcoded text like "SUCCESS" with the primary key along with it. For example,
//SUCCESS should be the hardcoded value from frontend as well.
Cognito allows you to attach lambda triggers to multiple points in the authentication process.
You can attach a lambda function to the pre token generation trigger.
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-token-generation.html
In your function you can do many things.
Create a cloud watch log entry with user info that can be viewed.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html
Trigger a cloud watch action.
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/cloudwatch-examples-using-alarm-actions.html
Create a db entry with a timestamp and create your own hi to view the data.