Can we get the list of users who not logged in more than 3 months in jira, confluence and bitbucket

prasad biddika
Contributor
June 7, 2023

Hi thanks for your help

 

Can we get the list of users who not logged in more than 3 months in jira, confluence and bitbucket?

Is this possible using groovy? can we automate to send a report?

Pls help with the same same

Thanks,

Prasad

 

2 answers

0 votes
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2023

For Jira you can use this:

LoginManager loginManager = ComponentAccessor.getComponentOfType(LoginManager)
loginManager.getLoginInfo(userName).getLastLoginTime()
0 votes
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2023

Since you're on Jira-Server (recall that support is soon going away - consider moving to Data Center like we did or to Cloud) and have a local database, you or your DBA can run a query like the following if you're running MySQL (will need to modify if you're running a different DB) for Jira. Likely something similar for Confluence and Bitbucket.

select user_name,display_name,DATE_FORMAT(from_unixtime(attribute_value/1000),'%Y/%m/%d') as last_login
from cwd_user u
left join cwd_user_attributes ua on ua.user_id = u.ID
where active = 1
and attribute_name = 'login.lastLoginMillis'
and from_unixtime(attribute_value/1000) < date_sub(now(),INTERVAL 90 day)
order by attribute_value desc

Suggest an answer

Log in or Sign up to answer