Add entry to Audit Log in Jira via Java API

I would like to add information to the Audit Log in Jira via Java API from Java code in a Jira plugin I am developing.

I found the package com.atlassian.jira.auditing in the Jira API, but I don’t understand how it is working.

Is there a tutorial which describes how to use Jira Java API to add entries to Audit Log? Or can somebody provide sample code?

Best regards
Holger

1 Like

Coming back to this old question, I found an documentation request https://jira.atlassian.com/browse/JRASERVER-72082 which is still open…

Kindly check https://developer.atlassian.com/server/framework/atlassian-sdk/audit/

Documentation can be found here https://developer.atlassian.com/server/framework/atlassian-sdk/audit/

This describes the “new” API introduced with Jira 8 Improvements to your Jira 8.8 audit log - Atlassian Developer Blog and a migration guide guide here Migrating to the new Jira audit log Java API

And here some guide New auditing features coming to Server/Data Center - What you need to know in Developer Community

Do you know what AuditResources like PROJECT or USER are supported? Is it this list maybe? AssociatedItem.Type (Atlassian Jira - Server 8.13.2 API), but just as string?

.affectedObject(AuditResource
    .builder(tmpProject.getName(), "PROJECT")
    .id(tmpProject.getId().toString())
    .build())

No idea what’s the correct values so the Jira Audit Log render the item properly adding links and so on…
That part is not so clear in the docs sadly…