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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.