How to report currently active users?

Before taking down an application for upgrade or maintenance we like to check which (if any) users are currently active (ie: have explicitly accessed a page).

Is there some way to report this (ideally with an SQL query), other than grepping the access log using something like:

fgrep -v -e '"GET /rest/' localhost_access_log.2012-12-06.txt | tail

2 answers

1 accepted

0 votes
Answer accepted

We use a macro based on Andrew Frayling's work:

You can tweak it to get users who have accessed pages within the last few minutes, for example.

Another thing we do is use Google Analytics, and check the real-time stats. That will tell you how many users are currently using the site (within the last 1 minute, I think), and what pages they are on.



Many thanks Matthew, I'll try that when I get some time.

For now, since Atlassian confirm they have nothing ( I'm using a slightly more elaborate access log report:

awk '
/ "GET \/rest/ { next }	# Ignore Ajax fetches
   userName = $3                    # $1: IP, $2: Hyphen usually
   TS = $4                          # In form [dd/Mmm/yyyy:hh:mm:ss    $5: +0000] $6: $GET $7: /url/...
   USERS[userName] = substr(TS, 2)  # Array key is name, value is timestamp
   for (userName in USERS)
      print USERS[userName], userName
' `ls -t localhost_access_log.*.txt | sed -n 1,2p` | sort # Check last 2 days' logs

Sorry - `back-quoted` command on last line above should have "| tac" at end. ie:

' `ls -t localhost_access_log.*.txt | sed -n 1,2p | tac` | sort

Hi Peter,

This SQL query should be enough to retrieve all users that belong in a group which has global permissions:

SELECT DISTINCT u.lower_user_name
FROM cwd_user u
JOIN cwd_membership m ON = child_user_id
JOIN cwd_group g ON m.parent_id =
JOIN spacepermissions sp ON g.group_name = sp.permgroupname

Hope it helps!

Thanks Alyson - that's handy, but I want currently active users. eg: to see if I need to postpone down time and/or contact them when about to take Confluence down.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,174 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you