How to download audit logs from Automation Cloud programmatically?

How to download audit logs from Automation Cloud programmatically?

Step 1: Create a confidential External Application and obtain App ID and App Secret

  1. Follow the documentation to create a confidential external application

    1. Select Application Scope(s): PM.Audit PM.Audit.Read under Platform Management API Access
      image.png image.png

    2. Provide values for Application Name

    3. Click on 'Add'. The confidential external application will be created and a prompt with the values for App ID and App Secret will be shown. Note the values for App ID and App Secret and save them securely image.png

Step 2: Download audit logs using the command line tool.

  1. Download the attached command line tool (UiPathAuditLogDownloadHealper.sh ) and save it in the destination folder for the audit logs.

  2. [Optional] Install needed dependencies: - Download and install JQ:

  3. Open Command Prompt (for Windows) or Terminal (for Mac) and execute the command line tool using the following syntax: bash UiPathAuditLogDownloadHealper.sh "{AppID}" "{AppSecret}" {OrganizationIdOrName} {LogFromDate} {LogTimeToDate} {logBreakIntervalInDay}

    • AppID: theApp ID of the external application obtained previously.

    • AppSecret: the App Secret of the external application obtained previously.

    • OrganizationIdOrName: Organization Id or Organization Name

    • LogFromDate: the date when the log should start, in format of MM/DD/YYYY

    • LogToDate:the date when the log should end, in format of MM/DD/YYYY

    • logBreakIntervalInDay (optional): the log break interval in days, meaning the number of days each audit log file shoud cover. By default, each audit log file will cover the log for 1 day, multiple files will be generated if the LogFromDate and LogToDate covers multiple days.

Example: bash UiPathAuditLogDownloadHealper.sh "12345678-1234-1234-1234-123456789012" "myAppSecret" ianrencloudtest 06/25/2023 07/20/2023 10


Output