Uploaded image for project: 'Automation for Cloud'
  1. Automation for Cloud
  2. AUTO-539

Ability to export Automation Audit logs and/or access via API

    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Problem

      Currently, it's not possible to export the audit log of Automations (both JSD Automation and Project automation).

      Suggestion

      Add the ability to export the audit log for better analysis and a better view of the details of each execution.

            [AUTO-539] Ability to export Automation Audit logs and/or access via API

            Bin added a comment -

            The filter and search for automation audit is improving and still limited.  Please allow export the more data fields out so we can do the search or filter in Excel or other format.  One use case is an issue is deleted by automation rule but I want to find out which rules did it.  So I'd love to be able to search for associated item aka the issue key.

            Bin added a comment - The filter and search for automation audit is improving and still limited.  Please allow export the more data fields out so we can do the search or filter in Excel or other format.  One use case is an issue is deleted by automation rule but I want to find out which rules did it.  So I'd love to be able to search for associated item aka the issue key.

            Would be amazing if this is implemented. Just a single button to export the logs into a sensible format, so values can be analyzed outside of JSM. Current filtering options are not enough to respond to issues.

            Jorge Martinez Bonilla added a comment - Would be amazing if this is implemented. Just a single button to export the logs into a sensible format, so values can be analyzed outside of JSM. Current filtering options are not enough to respond to issues.

            Really need this, please. Helps with digging through all the details of executions in the past ...

            Yatish Madhav added a comment - Really need this, please. Helps with digging through all the details of executions in the past ...

            Nolan added a comment -

            The script that @Jose Luis Gonzalez 2 wrote worked for me. There's a commented out part that's not quite finished (doesn't write to file, just prints to screen) for getting the "Show More" detail part of it. I only needed the associated issues, which don't require the additional level actually when you hit the API directly. 

            The only real issue was my CSV was malformed (not quoted when delimiters are in the data) as the `csv` module would do, but it's most of the way there. If I make updates I'll try to post that. 

            Nolan added a comment - The script that @Jose Luis Gonzalez 2 wrote worked for me. There's a commented out part that's not quite finished (doesn't write to file, just prints to screen) for getting the "Show More" detail part of it. I only needed the associated issues, which don't require the additional level actually when you hit the API directly.  The only real issue was my CSV was malformed (not quoted when delimiters are in the data) as the `csv` module would do, but it's most of the way there. If I make updates I'll try to post that. 

            Melanie Stevens added a comment - - edited

            hi there,

            i asked my developer to run the python script above that was posted 21/Mar/23 however it does not seem to provide the level of detail about any errors that occur within an automation rule rather just the top level and whether it was a success, which includes the following columns.

            execution id category start time rule name rule id items

            if i want to be able to drill down on the Show more

             

            Is this possible?

            Thanks

            Melanie Stevens added a comment - - edited hi there, i asked my developer to run the python script above that was posted 21/Mar/23 however it does not seem to provide the level of detail about any errors that occur within an automation rule rather just the top level and whether it was a success, which includes the following columns. execution id category start time rule name rule id items if i want to be able to drill down on the Show more   Is this possible? Thanks

            Jose Luis Gonzalez added a comment - - edited

            Hi all,

            I took the opportunity to collaborate with this feature request. You can use the next script to retrieve the automation logs. I hope you find it helpful:

            How to run:

            • login into id.atlassian.com in firefox
            • install python, browser_cookie3 with pip
            • Replace the cloudId (get the id from admin.atlassian.com -> Products) and cloudURL
            • Run it with python script_name.py
            import requests
            import browser_cookie3
            import json
            import datetime
            
            # Log in your site in firefox before running this file
            cookies = browser_cookie3.firefox()
            
            
            def main():
                # Base url, path and the instance's cloud id get it from admin.atlassian.net
                filename = "automation_logs.csv"
                cloud_id = '6934850d-9e66-4a83-948e-123445' 
                cloud_url = 'https://siteURL.atlassian.net'
            
                file = open(filename, "w")
                file.write("execution id, category, start time, rule name, rule id, items\n")
            
                full_url = "<cloud_url>/gateway/api/automation/internal-api/jira/<cloud_id>/pro/rest/GLOBAL/auditlog?limit=50&offset="
                full_url = full_url.replace('<cloud_id>', cloud_id).replace('<cloud_url>', cloud_url)
            
                # Change the range upper limit
                for iteration in range(0, 200, 50):
                  print("Executing " + full_url+str(iteration))
                  response = requests.get(full_url+str(iteration), cookies = cookies)
                  
            
                  jsonResponse = json.loads(response.text)
            
                  for item in jsonResponse["items"]:
                    involvedId = ""
                    for id in item["associatedIds"]:
                      involvedId = id +";"+involvedId 
                    file.write(str(item["id"]) + "," + item["category"] + "," + str(datetime.datetime.utcfromtimestamp(item["startTime"]/1000.0)) + "," + item["ruleName"]+ "," + str(item["ruleId"]) + "," + str(involvedId) + "\n")
                    #print(item["id"], item["category"], datetime.datetime.utcfromtimestamp(item["startTime"]/1000.0), item["ruleName"], item["ruleId"], involvedId, sep=',' )
            
                    
                    
                    execution_url = "<cloud_url>/gateway/api/automation/internal-api/jira/<cloud_id>/pro/rest/GLOBAL/auditlog/item/"+ str(item["id"])
                    execution_url = execution_url.replace('<cloud_id>', cloud_id).replace('<cloud_url>', cloud_url)
                    # uncomment to Optionally get the details of each execution
                    #response_exec = requests.get(execution_url, cookies = cookies)
                    #print(response_exec.text)
                file.close()
                
            if __name__ == '__main__':
                main()
            

             

            Jose Luis Gonzalez added a comment - - edited Hi all, I took the opportunity to collaborate with this feature request. You can use the next script to retrieve the automation logs. I hope you find it helpful: How to run: login into id.atlassian.com in firefox install python, browser_cookie3 with pip Replace the cloudId (get the id from admin.atlassian.com -> Products) and cloudURL Run it with python script_name.py import requests import browser_cookie3 import json import datetime # Log in your site in firefox before running this file cookies = browser_cookie3.firefox() def main(): # Base url, path and the instance's cloud id get it from admin.atlassian.net filename = "automation_logs.csv" cloud_id = '6934850d-9e66-4a83-948e-123445' cloud_url = 'https: //siteURL.atlassian.net' file = open(filename, "w" ) file.write( "execution id, category, start time, rule name, rule id, items\n" ) full_url = "<cloud_url>/gateway/api/automation/internal-api/jira/<cloud_id>/pro/ rest /GLOBAL/auditlog?limit=50&offset=" full_url = full_url.replace( '<cloud_id>' , cloud_id).replace( '<cloud_url>' , cloud_url) # Change the range upper limit for iteration in range(0, 200, 50): print( "Executing " + full_url+str(iteration)) response = requests.get(full_url+str(iteration), cookies = cookies) jsonResponse = json.loads(response.text) for item in jsonResponse[ "items" ]: involvedId = "" for id in item[ "associatedIds" ]: involvedId = id + ";" +involvedId file.write(str(item[ "id" ]) + "," + item[ "category" ] + "," + str(datetime.datetime.utcfromtimestamp(item[ "startTime" ]/1000.0)) + "," + item[ "ruleName" ]+ "," + str(item[ "ruleId" ]) + "," + str(involvedId) + "\n" ) #print(item[ "id" ], item[ "category" ], datetime.datetime.utcfromtimestamp(item[ "startTime" ]/1000.0), item[ "ruleName" ], item[ "ruleId" ], involvedId, sep= ',' ) execution_url = "<cloud_url>/gateway/api/automation/internal-api/jira/<cloud_id>/pro/ rest /GLOBAL/auditlog/item/" + str(item[ "id" ]) execution_url = execution_url.replace( '<cloud_id>' , cloud_id).replace( '<cloud_url>' , cloud_url) # uncomment to Optionally get the details of each execution #response_exec = requests.get(execution_url, cookies = cookies) #print(response_exec.text) file.close() if __name__ == '__main__' : main()  

            We have several thousand rules implemented and to find and error is nearly impossible.

            Having a possibility to extract all the audit log would definitely help.

            Andreas Zeindler added a comment - We have several thousand rules implemented and to find and error is nearly impossible. Having a possibility to extract all the audit log would definitely help.

            Hi team,
            For this export you could enter more details for example if a trigger was changed to another trigger. This will help us a lot. 

            Renan Barboza added a comment - Hi team, For this export you could enter more details for example if a trigger was changed to another trigger. This will help us a lot. 

            I want to vote for this issue. It causes time-consuming, so this output will significantly change the performance.

            Miyuki Nakamura added a comment - I want to vote for this issue. It causes time-consuming, so this output will significantly change the performance.

            Sue Lund added a comment -

            It is very difficult trying to find out what goes wrong with regard to tickets and automation.  We have an automation rule set to send emails to groups we assign tickets to (we use a custom field for it, to limit the number of groups in JSM).  If someone says they didn't receive an email for a specific ticket, it would be a huge time saver if we could search for the ticket number in the audit logs.  Having to scroll through the pages, to find the log entries close to the date/time that the email should have gone out, is not fun.

            Sue Lund added a comment - It is very difficult trying to find out what goes wrong with regard to tickets and automation.  We have an automation rule set to send emails to groups we assign tickets to (we use a custom field for it, to limit the number of groups in JSM).  If someone says they didn't receive an email for a specific ticket, it would be a huge time saver if we could search for the ticket number in the audit logs.  Having to scroll through the pages, to find the log entries close to the date/time that the email should have gone out, is not fun.

              e0eb84d6fb47 Dhanapal Mohanasamy
              adaluz Angélica Luz
              Votes:
              317 Vote for this issue
              Watchers:
              163 Start watching this issue

                Created:
                Updated: