Ways to Extract the Robot Logs using API

How to pull / extract the Robot Logs data in CSV format

What are Robot Logs?

Robot logs are time-stamped files that contain informational events, errors and warning messages relevant to the application. You can read more in Understanding Robot Logs.

Extraction of Robot Logs

In order to extract the Robot logs, follow the steps below, based on the type of deployment:

  1. For On-Premises Deployment:

For extracting logs using API calls you may use Swagger/Postman.

Using Swagger:

      1. Log in to the Orchestrator.
      2. Open a new tab to open the Swagger: Go to <Orchestrator URL>\Swagger
      3. Refer to Retrieving Robot Logs According to the Robot Name documentation to start calling Robot logs API(s).

Pre-requisite:
X-UIPATH-OrganizationUnitId
To extract it, you should call 'odata/Folders' API.

Note: GET requests for Robot logs stored using Elasticsearch only retrieve the first 10000 entries. This is due to an Elasticsearch limitation, and it does not occur if you are using SQL.
Using $top and $skip parameters which go beyond the 10000 limit return the following error message: "Depth of pagination is limited in Elasticsearch by the max_result_window index setting. Make sure skip + take is lower than 10000."

Using Postman:

      1. Generate the Bearer token referring to Using OAuth For External Apps documentation.
      2. Refer to Retrieving Robot Logs According to the Robot Name documentation to start calling Robot logs API(s).
Pre-requisite:
Bearer Token: Steps mentioned above.
X-UIPATH-OrganizationUnitId:To extract the same, one should call 'odata/Folders' API.

Extracting logs from the Database:

The Robot logs reside in the "dbo.logs" table and can be extracted using the below approach:

      1. Log in to the Database.
      2. Open a New Query window
      3. Use the below command in case you are looking to extract all the logs from DBO.Logs table: Select * from [UiPath Database Name].[dbo].[logs]
      4. From the output, right-click and save the logs in CSV format.

  1. For Automation Cloud Deployment:

Exporting logs via the Cloud User Interface:

To export Robot logs generated in the Orchestrator services to Azure, AWS S3, and Google Cloud Storage, see the specific procedures described in the Exporting Logs documentation.

Extracting logs using API calls:

Using Swagger:

      1. Log in to Orchestrator.
      2. Open a new tab to open the Swagger: Go to <Orchestrator URL>\Swagger
      3. Refer to Retrieving Robot Logs According to the Robot Name documentation to start calling Robot logs API(s).

Pre-requisite:
X-UIPATH-OrganizationUnitId
To extract the same, one should call 'odata/Folders' API.

Note: GET requests for Robot logs stored using Elasticsearch only retrieve the first 10000 entries. This is due to an Elasticsearch limitation, and it does not occur if you are using SQL.
Using $top and $skip parameters which go beyond the 10000 limit return the following error message: Depth of pagination is limited in Elasticsearch by the max_result_window index setting. Make sure skip + take is lower than 10000.


Using Postman:

      1. Generate the Bearer token referring to Using OAuth For External Apps document.
      2. Refer to Retrieving Robot Logs According to the Robot Name documentation to start calling Robot logs API(s).
Pre-requisite:
Bearer Token: Steps mentioned above.
X-UIPATH-OrganizationUnitId:To extract the same, one should call 'odata/Folders' API.

Hi is there any way we can retrive last log of a robot and subtract with the atual hour and date. I have a robot and is erros is that is not going to get the logs is getting the time that e gets the log of the robot.
Ex: robot 1 last log was 13:27:43 and the robot that is getting the last log retrives de hour 15:41:23. Not the hour of the last log.