Export Audit Logs

Description

The 'Export Audit Logs' endpoint returns a list of Leapwork Audit Log entries between the From Date and To Date in Json format.

The dates should be input in the local time zone of you Leapwork controller's machine, in the formats:

  • yyyy-MM-dd HH:mm

OR

  • yyyy-MM-dd (If no time is provided)

yyyy = (years)                                                       

MM = (months)                                                  

 dd = (days)

HH = (hours)

mm = (minutes)

This time is then converted to UTC by the API for processing.

From Date is mandatory for the user to input, but To Date is optional and automatically considers the current time.

All the columns are available as export that are visible in the Leapwork Studio Audit Log Settings.

Please note that this endpoint will work with both Leapwork editions – Enterprise and Platform.

Request URL

(GET) http://{controllerMachine}:{controllerPort}/api/v4/auditlogs/export

Input parameters

Field

Type

Description

Comment

accessKey

string

An access key is required to restrict unauthorized access to the API.

The Access Key should include an Audit Logs scope to access this API.

fromDate

string

From Date filter of Audit Log entries.

Input format:-
yyyy-MM-dd HH:mm
Or
yyyy-MM-dd

Please add the time in local time zone of the controller machine. The time will be converted to UTC.

toDate

string

To Date filter of Audit Log entries.

Input format:-
yyyy-MM-dd HH:mm
Or
yyyy-MM-dd

Please add the time in local time zone of the controller machine. The time will be converted to UTC.

 

Examples

Curl

curl -X GET --header 'Accept: application/json' --header 'accessKey: wITrC7cjthxW5pPg' 'http://localhost:9001/api/v4/auditlogs/export?fromDate=2022-04-18%2000%3A00&toDate=2022-04-18%2017%3A15'

PowerShell 

$headers = @{}
$headers.Add("
accessKey","wITrC7cjthxW5pPg")
Invoke-WebRequest -Uri "
http://localhost:9001/api/v4/auditlogs/export?fromDate=2022-04-18%2000%3A00&toDate=2022-04-18%2017%3A15" -ContentType "application/json" -Headers $headers -Method GET

Response

Audit Logs returned in the response.

[

{

   "Date": "2022-04-18 10:50:23",

   "IPAddress": "127.0.0.1",

   "Hostname": "LAPTOP-UFSQU872",

   "UserOrSystem": "Administrator",

   "Team": "Team 1",

   "Event": "Login",

   "Asset": "Administrator",

   "Details": "Administrator"

}

]

 

Response object

Field

Type

Description

Values

Date

string

Date of entry of Audit Logs

Format returned: -

yyyy-MM-dd HH:mm:ss

 

The date is converted from UTC to local time zone of the controller machine and returned as output.

IPAddress

string

IP address of user machine from which logs are audited

 

Hostname

string

Hostname of user machine from which logs are audited

 

UserOrSystem

string

Type of Auditor

It can have possible values:- User, Scheduler, Controller, Studio, API.

Team

string

Team name

This field will not appear in the case of the Leapwork Platform Edition.

Event

string

Event name

 

Asset

string

Asset name

 

Details

string

Audit log details

 

Response Codes

200 (OK)

 

400 (Bad Request – eg: “From Date and To Date cannot be set to a date in future”, “From Date cannot be greater than To Date”, “Invalid From Date”, “Invalid To Date”)

401 (Unauthorized - eg: “Incorrect Accesskey”)

403 (Forbidden – eg: “AccessKey does not have the relevant scope permission”)

500 (Internal Server Error)