Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello together
I am writing a monitor plugin for Bitbucket. I need to get the number of users who are logged in, so i need the number of user sessions. I tried to do it with the Bitbucket Java API but I can't seem to find a class and method that provides this information.
Do you guys know where i can get that information? Java or REST API? Database? I couldn't find it anywhere but it's almost certainly possible.
Thanks for the help.
Hi Joel,
An approach you could take here could be to use a combination of the following information:
- last login for a user
- session duration
The last authentication can be retrieved with the /rest/api/1.0/admin/users REST API and is also displayed in the user interface (see this article for more details) and. The GET method will return the lastAuthenticationTimestamp.
Just by using the last authentication, you should get a good understanding of which users are using Bitbucket Server. This value is update both for browser login and git operations.
The session timeout is 30 minutes, but depending on the remember-me configuration may be longer (see bitbucket.properties).
For monitoring, we usually suggest to rely on the access log (see how to read the Bitbucket Server logs) and enabling the JMX counters (JMX counters for Bitbucket Server). At the moment they don't provide exactly the session count, but may give you some alternative ideas on the items to monitor.
Thanks, Caterina - Atlassian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.