Hi All,Is there any Sql query to get the list of Jira Software as well as Jira Service Desk Active users last login details.I have found the below article as part of my search. but this article is NOT giving the last login of the "Jira and Jira Service Desk Active users last login'
- https://confluence.atlassian.com/jirakb/how-to-get-a-list-of-active-users-counting-towards-the-jira-application-license-278695452.html\\ - https://confluence.atlassian.com/jirakb/retrieve-last-login-dates-for-users-from-the-database-363364638.html
I tried to make a query by using these two articles but that didn't worked for me.
Please advise.Thanks,Surender
I think you can combine these two queries, but there are some considerations when doing so. Each of these articles is seeking something slightly different so the SQL select statements are specifically geared for the results in question. That said, I think I have found a way for you to see the last login time of specific users in a licensing role. For Service Desk Agents:
SELECT d.directory_name AS "Directory", u.user_name AS "Username", to_timestamp(CAST(attribute_value AS BIGINT)/1000) AS "Last Login", lrg.license_role_nameFROM cwd_user uJOIN ( SELECT DISTINCT child_name FROM cwd_membership cm JOIN licenserolesgroup gp ON cm.parent_name = gp.GROUP_ID ) AS cm ON cm.child_name = u.user_nameJOIN ( SELECT * FROM cwd_user_attributes ca WHERE attribute_name = 'login.lastLoginMillis' ) AS a ON a.user_id = u.idJOIN cwd_directory d ON u.directory_id = d.idJOIN cwd_membership m ON u.id = m.child_id AND u.directory_id = m.directory_id JOIN licenserolesgroup lrg ON Lower(m.parent_name) = Lower(lrg.group_id)WHERE d.active = '1' AND u.active = '1' AND license_role_name = 'jira-servicedesk'ORDER BY "Last Login" DESC;
And for Jira Software users:
SELECT d.directory_name AS "Directory", u.user_name AS "Username", to_timestamp(CAST(attribute_value AS BIGINT)/1000) AS "Last Login", lrg.license_role_nameFROM cwd_user uJOIN ( SELECT DISTINCT child_name FROM cwd_membership cm JOIN licenserolesgroup gp ON cm.parent_name = gp.GROUP_ID ) AS cm ON cm.child_name = u.user_nameJOIN ( SELECT * FROM cwd_user_attributes ca WHERE attribute_name = 'login.lastLoginMillis' ) AS a ON a.user_id = u.idJOIN cwd_directory d ON u.directory_id = d.idJOIN cwd_membership m ON u.id = m.child_id AND u.directory_id = m.directory_id JOIN licenserolesgroup lrg ON Lower(m.parent_name) = Lower(lrg.group_id)WHERE d.active = '1' AND u.active = '1' AND license_role_name = 'jira-software'ORDER BY "Last Login" DESC;
Neither of these queries should return inactive users
Hi Andrew,
Thanks for the response.
The query seems to be working but it is not listing ALL the users login details.
Here is the output for the Jira Service Desk users last logins based on the query given above.
"Active Directory server" "865980" "2018-09-21 16:59:15+00" "jira-servicedesk""Active Directory server" "132885" "2018-08-22 18:27:16+00" "jira-servicedesk""Jira Internal Directory" "Local.Admin.User" "2018-08-02 20:35:37+00" "jira-servicedesk""Jira Internal Directory" "uditjakhotia" "2018-04-23 21:01:56+00" "jira-servicedesk""Jira Internal Directory" "nkothapalli" "2018-04-13 18:08:57+00" "jira-servicedesk"
Thanks,
Surender
Are you looking for the login times of users in the Jira Service Desk customer role? If so, those users are not actually expected to be returned by either of the queries I have listed above. The reason for that is that users in this role are actually unlicensed users in Jira. They don't consume a license seat, hence Service Desk allows you to have an unlimited number of customers in that role.
The results you see there are users in the Service Desk Agent role. These are users that consume a license seat for service desk.
Does this explain the results you see? Or are you expecting to see something different?
I understand the licensing functionality.
I am looking to get the last login details of the service desk agents (Licensed users) not the customers (Unlicensed users).
Currently we have around 200 Service desk agents. but as per the above query i am getting only 5 users last login details.
It would be helpful for me if i get a last login of the users,
- Who were never logged/used the service desk
- Who were not logged in for morethan 30 days.
I am looking the above functionality to the Jira Software too.
We are using "Jira Service Desk" and "Jira Software" as our application access names/categories.
Hope it clarifies.
It looks like you're new here. Sign in or register to get started.