Retrive user login count within date range - not total login count

I just want to check how many times in a week a user is login in to my app. If i use /api/v2/users?per_page=100&q=last_login:{" + from + " TO " + to + "} i am getting the total login cont not the selected date range login count. Is there any way we can get the selected date range login count of each user.

1 Like

The last_login value gets overridden at each login so with a search like the one you shown you could answer the question of how many users performed a login within a specific time range, but it won’t allow you to answer how many times the same user performed a login on that same time window.

You should consider configuring an extension that exports the generated logs to an external system where you could have more control over how long the logs are retained and also then implement additional query capabilities that would allow to answer questions such as the one you mentioned. This would allow to answer your query by counting the number of log events (representing a login) for a specific user and within a specific time frame.