Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,686
Community Members
 
Community Events
168
Community Groups

SQL query to find all users who never logged in

Hi,

Do you know how can I get the list of users who never logged in into Confluence, while Confluence is connected to JIRA directory.

This query does not seem to work as it brings me users who actually logged in

What is the right way to find these users?

 

Many thanks!

 

select user_name from cwd_user where user_name not in
(SELECT cwd_user.user_name
FROM cwd_user, cwd_user_attribute
WHERE cwd_user_attribute.user_id = cwd_user.id
AND cwd_user_attribute.attribute_name = 'lastAuthenticated');

 

2 answers

1 vote
Shannon S Atlassian Team Dec 10, 2019

Hello Simha,

Thank you for contacting us about this. The query is indeed the right one, the same as the one listed in How to check for users who never logged into Confluence:

select user_name from cwd_user where user_name not in
(SELECT cwd_user.user_name
FROM cwd_user, cwd_user_attribute
WHERE cwd_user_attribute.user_id = cwd_user.id
AND cwd_user_attribute.attribute_name = 'lastAuthenticated');

The query should list any users who do not have a last authenticated date listed. I just ran the query on my own instance, and I can confirm it only returns users who have never logged in. 

If you're getting another result there, you could also try the query at How to Identify Inactive Users in Confluence. You'll be able to list users who have not been active since a certain date. 

Let me know if you have any questions about that.

Regards,

Shannon

I have same issue like Simha. The provided sql shows user that do have a last login date.

The correct query should use the 'login.count' attribute instead. Like this.

SELECT LOWER_USER_NAME as username, lower_email_address as email, lower_display_name as displayname
FROM CWD_USER 3WHERE LOWER_USER_NAME not in
(SELECT CWD_USER.LOWER_USER_NAME
FROM CWD_USER, CWD_USER_ATTRIBUTES
WHERE CWD_USER_ATTRIBUTES.USER_ID = CWD_USER.ID
AND CWD_USER_ATTRIBUTES.ATTRIBUTE_NAME = 'login.count');

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events