Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,313
Community Members
 
Community Events
184
Community Groups

Filtering the Audit Log via API

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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

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