Filtering the Audit Log via API

Jordan Berry May 12, 2023

Having a really hard time with this one. I have a lot of experience with Atlassian's API, but this one has broke me. I have no issue getting the base call to work, but filtering against it just isnt working. Going off of this documentation: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-audit-records/#api-group-audit-records

 

The call that I have working is the base found in the documentation. I was playing with Google App Scripts, but switched to Python. Base call looks like this

"https://mycompany.atlassian.net/rest/api/3/auditing/record". I get 10k+ records, but thats a nightmare to filter.
The documentation says you can add a filter, to, and from dates. Doing something like the following pulls the same count of records: "https://mycompany.atlassian.net/rest/api/3/auditing/record?filter=Role". Adding single quotes around Role makes no impact. Going through the UI, there should be significantly less.
Moving on to the dates, filtering using them gives the same response as the filter, where it just returns 10k+ records when filtered for a single day.
In the end, what I am asking for, is an example API call to the audit log with filters applied. I have spent so much time on it already and I am at a loss.

1 answer

0 votes
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 15, 2023

@Jordan Berry 

Hey Jordan!

I'm not sure what exactly information you want to get from audit log, but i managed to perform this filter in the audit log using this Endpoint:

https://mycompany.atlassian.net/rest/api/2/auditing/record?from={{now.minusdays(1).jiraDateTime.urlencode}}&filter=Status

 

As you should know {{now.minusdays(1).jiraDateTime.urlencode}}, will get the previous days that I want to read the log and &filter=Status will filter the log.

I noticed that you are using API v3 while I am using v2.

Just in case I did a test using the same endpoint, but with v3 > https://mycompany.atlassian.net/rest/api/3/auditing/record?filter=Status

And it worked fine too.

If it doesn't work for you, can you share more details of the information you want to extract and also your automation log

Hope this helps.

Fernando

Jordan Berry May 16, 2023

Hey Fernando,

It was an issue of looking at the problem too long. Turns out the filter works just fine, but the total value always returns the total for your instance. I had to get the count of keys from the records specifically.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events