User last login for deprovisioning

Product/components used and version/fix level:

C8Y, 10.18

Detailed explanation of the problem:

We are looking to create an automated process to deprovisioned / disable the user from Cumulocity after 90 days of inactivity.

What we need an API which can give me bulk list of user with their last login. Is there any API available?

Error messages / full error message screenshot / log file:

Question related to a free trial, or to a production (customer) instance?

Maybe check audit entries, but login only recorded for Oauth i think.

https://cumulocity.com/api/core/10.18.0/#tag/Audits

image

Thanks @Robert_Neale, I have reviewed the audit entries, but to retrieve the user’s last entry, I need to pass the username in the audit query. If I omit this parameter, I would need to paginate through multiple entries, which would result in querying a large amount of data to determine the last login. Is there any simpler approach to get all user last login?

Just commenting here to say we also had a need for such an API, but back then it turned out that the platform is not yet able to provide such data.

There is a related Improvement idea to include such a feature (and the corresponding API), you can vote for it here:
Request to add lastlogin information | Cumulocity IoT Feedback Portal (aha.io)

Automatically disable users if not | Cumulocity IoT Feedback Portal (aha.io)

2 Likes

Okay, Is there a way in audit log that I can get selected multiple user audit recored on one API call?

/audit/auditRecords?dateFrom=1970-01-01&dateTo=2024-08-01T17:59:18%2B05:30&pageSize=100&revert=true&user=oneuser@com&user=twouser@com&withTotalPages=true – Tried this but no luck.

No, it’s one user per request.
If you specify two they negate each other.
Your example would need to be done in two separate requests.

Thanks. So, I assume there is no way to retrieve the last login for a user? To get a list of all users with their last login times, we would need to individually access the audit records for each user to obtain this information.

Nothing ‘out of the box’. REST call to return audit records when Oauth used, then look for ‘User logout’.