How to download audit logs from Automation Cloud programmatically?
Step 1: Create a confidential External Application and obtain App ID and App Secret
-
Follow the documentation to create a confidential external application
-
Select Application Scope(s): PM.Audit PM.Audit.Read under Platform Management API Access
-
Provide values for Application Name
-
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
-
Step 2: Download audit logs using the command line tool.
-
Download the attached command line tool (UiPathAuditLogDownloadHealper.sh ) and save it in the destination folder for the audit logs.
-
[Optional] Install needed dependencies: - Download and install JQ:
-
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