How to pull the overall number of logins this month for JIRA? (PostgreSQL)
I need this for auditing and cant seem to get a number I will eventually need to do this for Confluence and Bitbucket, any help would be appreciated.
Hi @zapzap47 ,
Welcome to the community!
Below is an Oracle DB query for Jira. Please edit it for Postgres if required. This will return you all users with their last login details.
SELECT d.directory_name, u.id, u.directory_id, u.user_name, u.active, u.created_date, u.updated_date,u.first_name, u.last_name, u.display_name, u.email_address,TO_DATE('19700101','yyyymmdd') + ((a.attribute_value/1000)/24/60/60) as last_login_dateFROM cwd_user uLEFT JOIN (SELECT DISTINCT child_nameFROM cwd_membership mJOIN licenserolesgroup gp ON m.parent_name = gp.GROUP_ID) m ON m.child_name = u.user_nameLEFT JOIN (SELECT *FROM cwd_user_attributesWHERE attribute_name = 'login.lastLoginMillis') a ON a.user_id = u.IDLEFT JOIN cwd_directory d ON u.directory_id = d.IDorder by last_login_date desc;
Also,please note that last login date is not always correct if the user checks "remember me" per https://jira.atlassian.com/browse/JRASERVER-60508
Thanks,
Aditya
Hi, thanks for the reply but I am after the overall count of logins for the month not just on a user basis.
This will provide you list of users in descending order of their last login. You can export the data into an excel and easily filter out a month data.
Thanks,Aditya
I am after the whole count not just their singular logins to the total logins regardless of user so if a user logs in 30 times that month I need that
This requirement is folly and misguided. What is it trying to achieve?
Login counts are arbitrary and can be inflated without the user's knowledge, due to app links or due to basic auth in integrations.
Such a number surely cannot represent any meaningful data, because it:
* cannot be accurate
* can be inflated artificially
* can be inflated without the user's knowledge
* can differ due to session timeout
* can differ due to downtime
This is something that I require even if it can be artificially inflated by people spam logging in
Ok great but then it doesn't matter because the data you require is practically and theoretically useless.
And no, you won't get it with a single query, because such a number is not tracked anywhere, you would need to compare the table data between time ranges. I can assure you, nobody has written anything to do it, because the requirement is pointless.
It looks like you're new here. Sign in or register to get started.