How to query User Activity via SQL

Still need help?

The Atlassian Community is here for you.

Ask the community

For Atlassian eyes only

This article is Not Validated and cannot be shared with customers.

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Purpose

This query will allow you to pull the User Activity in Confluence as seen in the Activity tab of a user's profile.

Solution

  • You can run the below query against the database. Replace both instances of <username> in the below query with your user's exact username.

    select contenttype,title,creationdate,lastmoddate,pageid,spaceid 
    from content
    where creator = (select user_key from user_mapping where username = '<username>') or lastmodifier = (select user_key from user_mapping where username = '<username>');

    or to obtain this data for all users along with creation date, you can use something like:

    select c.contenttype, c.title, c.creationdate, c.lastmoddate, c.pageid, c.spaceid, u.username as "last change made by"
    from content c
    JOIN user_mapping u ON c.creator = u.user_key
    where creator IN (select user_key from user_mapping) or lastmodifier IN (select user_key from user_mapping) 
    group by c.contenttype, c.title, c.creationdate, c.lastmoddate, c.pageid, c.spaceid, u.username
    order by c.lastmoddate DESC;


DescriptionHow to query the database for user activity
ProductConfluence

Last modified on Aug 29, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.