I am working to help identify who is using my JIRA application (server 7.13.x) and curious if someone could share a SQL query to display number of JIRA issues per user.
Would be nice to include the name, email and number of issues within the last X months (if possible)
TIA
Hello, Mike. I can offer you a ready-made report that works as a rest service on the free plugin mygroovy. Your users will at any time be able to access such a report via a link in Jira. The configuration is as simple as possible; just insert a piece of code by changing a few variables: filter, userName, password
If you need the ability to limit the report to groups, change the variable groups to the desired
I got a lot of code, so I’ll put it in here: https://paste.ofcode.org/cyDfHPAmncFvDXxVPzZLNM
Hi Mike,
We detect user activity not by user / number of issues, but we verify count and date of last login to Jira. Not every user has to create in Jira issue, but can only read or comment, etc.
Here is our SQL:
SELECTDISTINCTu.lower_user_name, to_timestamp(CAST(last_loginASBIGINT)/1000)AS"Last Login", login_countFROMcwd_user uJOINcwd_membership mONu.id = m.child_idANDu.directory_id = m.directory_idJOINlicenserolesgroup lrgONLower(m.parent_name) =Lower(lrg.group_id)JOINcwd_directory dONm.directory_id = d.idLEFTJOIN(SELECTca.user_id, ca.attribute_valueaslast_loginFROMcwd_user_attributes caWHEREattribute_name ='login.lastLoginMillis')ASaONa.user_id = u.idLEFTJOIN(SELECTca.user_id, ca.attribute_valueaslogin_countFROMcwd_user_attributes caWHEREattribute_name ='login.count')ASbONb.user_id = u.idWHEREd.active ='1'ANDu.active ='1'ANDlicense_role_name ='jira-core'ANDu.lower_user_namenotin(SELECTu.lower_user_nameFROMcwd_user uJOINcwd_membership mONu.id = m.child_idANDu.directory_id = m.directory_idJOINlicenserolesgroup lrgONLower(m.parent_name) =Lower(lrg.group_id)JOINcwd_directory dONm.directory_id = d.idWHEREd.active ='1'ANDu.active ='1'ANDlicense_role_namein('jira-software','jira-servicedesk'))ORDERBY"Last Login"DESC;
Here is SQL result:
lower_user_name | Last Login | login_count
----------------------+------------------------+-------------
user1 | 2017-12-13 11:50:18+01 | 901
user2 | 2017-12-13 11:48:28+01 | 899
user3 | 2017-12-13 11:32:54+01 | 295
Pavel
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.