how to audit for unused automation rules?

Phillip C
Contributor
September 4, 2024

So over time automation rules increase and there is no simple way to go through and see when the last time an automation rule was run.

How can i audit our ~400 automation rules to see which ones haven't been run lately?

 

edit* Not looking for paid third party addons.

2 answers

6 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2024

Oh hey @Phillip C - so this is not a full solution, but maybe it will help you or somebody else.

@Hans Polder - yeah, there's no published API for Jira Automation Usage, but hey, not having a public API has never stopped me before. :-}

So, poking around, I found that you can programmatically get the top 100 used rules for the current month and prior 3 months. Here's endpoints you could use:

https://${SITENAME}.atlassian.net/gateway/api/automation/internal-api/jira/${CLOUDID}/pro/rest/GLOBAL/highestUsages?limit=100

https://${SITENAME}.atlassian.net/gateway/api/automation/internal-api/jira/${CLOUDID}/pro/rest/GLOBAL/highestUsages?limit=100&month=2024-08

(These are the APIs that power the Performance Insights that @Hans Polder referenced.)

I suppose you could combine this data with a listing of all your rules, and then identify rules that don't show up in the top 100 at all, and reasonably conclude that they're not being used.

I wrote a shell script to dump all the rules, generate some CSVs of the rules metadata, create a mapping file for the author IDs to names/emails, and also dump the usage data to a CSV. It requires curl and one of my favorite tools: jq.

https://bitbucket.org/rudebadmood/workspace/snippets/REz8Mp

These CSVs can then be attached to a Confluence Page where I used Stiltsoft's excellent Table Filter, Charts & Spreadsheets for Confluence to Transform that data into a table that you can sort/filter for # of executions, state (disabled or not), author, etc.

automationscreenshot.png

Oh and the links do take you directly to the rules.

I used the Table to CSV to convert each of the attached CSVs into tables, and those are nested inside of a Table Transformer using the following SQL query:

SELECT FORMATWIKI("[" + CONCAT(T1.'name', "|", "https://SITENAME.atlassian.net/jira/settings/automation#/rule/", T1.'id'),"", "]") as 'Name',
T1.'description' as 'Description',T3.'executionCount' as 'Executions', T1.'state' as 'State',
FORMATDATE(T1.'created') as 'Created', FORMATDATE(T1.'updated') as 'Updated',
FORMATWIKI("" + CONCAT(T2.'name', " <", T2.'email', ">"), "") as 'Author'
FROM T1
LEFT JOIN T2 ON T1.'authorAccountId' = T2.'id'
LEFT OUTER JOIN T3 on T1.'id' = T3.'id'

It's a little... complicated. But yeah, in theory you could plop the shell script on a Mac or Linux host somewhere and have it run every day or week or so, and you'd have a nice sortable/filterable catalog of your rules.

Oh, one last caveat: Cloud Confluence doesn't allow for nesting of macros, so I had to use "Table Toolbox" to put the Table Transformer "inside" of a Table Filter. That looks like this:

Screenshot 2024-09-14 at 5.57.57 PM.png

If Excel or Google Sheets is your jam, there's undoubtably some way to set CSV files as sources and do some kind of similar lookup across the files.

Hans Polder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 15, 2024

Looks very cool @Darryl Lee ! Thanks for responding to my plea for help in our chat.

Hopefully @Phillip C would be able to test this and report back - I'm marking it as action for when I return from my holidays :)

Phillip C
Contributor
September 18, 2024

thanks @Darryl Lee that is indeed an interesting way to go about it! I'll see how i fair attempting this to determine my automation rule usage.

Any questions i'm sure i'll reply back :)

0 votes
Hans Polder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 4, 2024

@Phillip C ,

What you could do, is go to: https://<YOUR ENVIRONMENT>.atlassian.net/jira/settings/automation#/performance-insights.

You can also access this through the regular System Administration section > Global Automation > the three dots on the top right > Performance Insights.

Screenshot 2024-09-05 065955.png

On this page, you can play around with the toggles to see the data for i.e. the last month. If you sort by execution count, you could identify rules that don't run that often (or maybe too often).

It only shows the top 20 rules though, so you might not get what you want here. 

Additionally, you could go to the list of automation rules, simply open them, and review their audit logs. This would help you identify other issues (outside of lack of use) as well. It can be a bit tedious, but it should be doable with ~400 rules.

More information here: https://support.atlassian.com/cloud-automation/docs/view-your-automation-usage

 

Hans Polder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2024

Hi @Phillip C ,

If this answer helped you, please mark it accepted to help other users find it.

Phillip C
Contributor
September 12, 2024

Hi Hans, no unfortunately this isn't viable for 400+ automations to manually go through each (well i mean sure i could, but heck no i dont want to). The sorting column only seems to bring back results for a small number of automations, so thats not helpful.

The platform falls short of auditing consumption. Surely I'm not the only Atlassian consumer in the world asking this question? Someone has been bound to figure this out already, given how trivial it seems?

Hans Polder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2024

@Phillip C ,

Thanks for your reply, and I'm sorry to hear that. I agree that it's not that straightforward. Or I might be missing something too, but then at least it's not something obvious. When replying to your initial question, I also checked if any of the Jira Automation REST APIs would be able to do this, but it doesn't appear to be the case.

Additionally, I also tried exporting the rules, but in those JSON results there doesn't really seem to be some information regarding when it was last used.

I just now tried searching the public backlog for Jira Automation but also there I couldn't really find anything resembling this use case. My last resort/suggestion would be to use the 'Give feedback about Jira' option in the Help-menu in Jira, as below:

Screenshot 2024-09-12 110940.png

Looking forward to hearing any findings you might encounter on this topic!

Suggest an answer

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

Atlassian Community Events