Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
Atlassian Team members are employees working across the company in a wide variety of roles.
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
AUG Leaders

Atlassian Community Events