Can robot send Log file as CSV after completing run?

uiautomation
orchestrator
logs
logging

#1

I know you can view the logs and export them from Orchestrator as CSV after completing an automation…is there a way that I can have the robot do this automatically and send as an email prior to completing in the workflow?


#2

sure, you just insert logs to an excel/csv file during robot execution using the excel scope or other csv activities, then put a send outlook mail activity before the last activity of your flowchart (with attaching the log csv file)


#3

Thanks Shan, I just wanted to confirm there is no other way vs doing it manually by appending logs to .csv or .xlsx file. It’s nice because after execution you can export a clean .csv file with the Time, Level, Process, User and Message columns all formatted, so I wasn’t sure if I could automate the effort of simply exporting the file vs creating it manually while the robot runs.


#4

Have you tried using an “Orchestrator HTTP Request” to download the csv straight from Orchestrator at the end of your process?
https://<server>/odata/RobotLogs/UiPath.Server.Configuration.OData.Reports?$filter=(JobKey eq <job key>)


#5

Thanks @qbrandon! I didn’t think to try this, I will give this a shot today and see if that gives me what I need. Appreciate your input.


#6

This is definitely on the right track, question is how can I build into the workflow to get the jobID to feed the request? I was able to do it manually through view the logs in Orchestrator but ideally I would want to have the robot do it all.


#7

How to determine the jobId depends a lot on your use case, but you can start by running GetJobs and filtering by:

  • MachineName
  • ProcessName
  • States

#8

I could really use this solution for my automated processes but I have no idea on how to use the “HTTP Request” activity, could you please post an example so I can use? Thank you!


#9

Main.xaml (6.0 KB)
Tested with 2018.1.3.
Note that on Orchestrator, I had to create a Role with only Log View privileges, and added that role the relevant robot user (by default, robot users do not have permission to access Logs)


#10

Thank you for your quick response!
Unfortunately when I open your xaml I got the following error:

Can it be because I do not have the proper package installed? The Activity you use is “HTTP Request” right?


#11

This activity requires at least 2018.1
Can you share what version you are using?


#12

When I try to use the Get Jobs activity I am unable to create a variable for the output…I get a blue exclamation error saying Type “OrchestratorJobs” does not exist. Any ideas on that?


#13

Hi qbrandon, sorry for my late response.
I’m using Studio version 2017.1.6522
Can this be achieved with the activity “HTTP Request”?


#14

This is less convenient, but yes, this can be achieved with the HTTP Request activity.
You will need to:

  1. login (get a session token in exchange of a username/password)
  2. request the Report using the URL mentioned here-above.

The process is described here (Authentication):
https://www.uipath.com/hubfs/Documentation/OrchestratorAPIGuide_2016.2/UiPathOrchestratorAPIGuide_2016.2.html#Authentication

The 2018.1 Orchestrator HTTP Request is more convenient because it automatically uses the robot credentials rather than have you manually handling user credentials.
Again, make sure that whatever user is used for auth, it needs to have the appropriate Orchestrator permissions.