Api example to fetch user last logintime for an application using systemlog api with filters?

Systemlog Api example to fetch user last logintime for an application using filters?

Hi @Hari1692 is your goal to work out the last time a User accessed a certain application?

A call to the system log api will return default 100 (up to 1000) events which you would have to parse and check. The filter parameter lets you specify events and objects to filter on.

You could try something like:

{{url2}}/api/v1/logs?filter=eventType+eq+“user.authentication.sso”+and+target.id+eq+“OKTA -APPLICATION-ID”

This should return the most recent attempts to access an application for a given application ID.

user.authentication.sso
Fired when a user performs a single sign-on (SSO) to an app instance and contains the client details of the user. Can be used to identify when a user attempted to sign into an application for audit or debugging purposes. Note that the event is fired even when the sign-on is unsuccessful.

You can play with the query in the System Log page in the Okta admin dashboard then open Chrome Dev Tools and check the network tab to see what the query you created looks like as an API call. You may just want to filter these events for successful ones.

1 Like