How to enable API access logging in Confluence

Still need help?

The Atlassian Community is here for you.

Ask the community

(warning) The below configuration works before 7.14.x. From 7.15.x, there is no need to enable <filters> in web.xml

Purpose

API calls are not logged by default in Confluence. You might want to enable this logging to debug any REST/XML-RPC related issues you are seeing.

Solution

Notes:

  • This is very similar to our documentation on how to enable user access logging. We will just make some tweaks to the URL patterns provided
  • Please do not modify the application-wide web descriptor, $server/conf/web.xml. This will be ineffective and potentially may break Confluence. 

To enable the AccessLogFilter:

  1. Uncomment this line in confluence/WEB-INF/classes/log4j.properties:

    log4j.category.com.atlassian.confluence.util.AccessLogFilter=INFO
    
  2. Enable the filter in confluence/WEB-INF/web.xml by removing the comments around these lines (or adding if they are not included):

            <filter-mapping>
                <filter-name>AccessLogFilter</filter-name>
                <url-pattern>/rest/*</url-pattern>
            </filter-mapping>
    
            <filter-mapping>
                <filter-name>AccessLogFilter</filter-name>
                <url-pattern>/rpc/*</url-pattern>
            </filter-mapping>
     
            <filter-mapping>
                <filter-name>AccessLogFilter</filter-name>
                <url-pattern>/soap/*</url-pattern>
            </filter-mapping>

    This combination of URL patterns will work for REST, XML-RPC, and SOAP API calls. You can further modify the pattern by adjusting the url-pattern field if you see any other URL patterns used in API calls that are not included in the above. For example, if you only want to capture REST calls for Team Calendars only, you can filter it as follows:

            <filter-mapping>
                <filter-name>AccessLogFilter</filter-name>
                <url-pattern>/rest/calendar-services/*</url-pattern>
            </filter-mapping>
    


Last modified on May 25, 2023

Was this helpful?

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