Hi Community,
I'm currently administering both Jira and Confluence Data Center and I'm looking for a reliable way to track the number of active individual users over a certain period (e.g., past 30 or 90 days).
if you are using ScriptRunner, you could create some kind of REST API to display the current amount of active users or create a job to run actions on inactive ones.
The following code can get all users that have had a login within the last 30 days as an array. And of course, this array could then be used for further processing.
import com.atlassian.jira.bc.security.login.LoginInfo
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.login.LoginManager
GroupManager gm = ComponentAccessor.groupManager
LoginManager loginManager = ComponentAccessor.getComponent(LoginManager)
List<ApplicationUser> users = []
int threshold = 30
gm.getAllGroupNames().each{group->
gm.getUsersInGroup(group).each{
if(it.active) {
LoginInfo loginfo = loginManager.getLoginInfo(it.username)
if (loginfo.getLastLoginTime() == null) {
if (!users.contains(it)) {
users.add(it)
}
}
else {
Date lastLogin = new Date(loginfo.getLastLoginTime())
int dif = new Date().minus(lastLogin)
if (dif >= threshold) {
if (!users.contains(it)) {
users.add(it)
}
}
}
}
}
}
return users
Hope this helps!
Stefan
Hi @Houssein Barkallah !
I see theres a feature request for a use case similar to this one: [JRASERVER-2841] List users inactive over a period of time - Create and track feature requests for Atlassian products. so I don't think you can have a lot of success with the UI.
If you have SQL access to the JiraDB, you can follow the steps outlined in this documentation to select users and their last log-in Find the last login date for a user in Jira server | Jira and Jira Service Management | Atlassian Support
It was updated on Aplil 2025 so it should be relevant enough 😊
Hope that was helpful!
Regards,
Jaime Escribano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.