Create URL to specfic job Logs

Hi!

My Feedback:
Please create option to go to specfic page in logs of specific job. I really miss the option to skip for.ex 20 page to see logs on page 21.

Question:
Is it possible to manipulate link in browser to skip some pages in logs of the job? Right now, when I am opening specific job and changing index it is not allowing me to follow that url - webpage is reloading and index automatically changing to ‘0’.

My Orchestrator: 2022.10.2 (on premise)

Create URL possible solution:

I am building solution to generate links to log page from robots. My idea:

  • robot in case of any error is sending mail with error detail.
  • inside workflow there would be an activity to create url.
  • URL created by activity will be pasted to mail message body.

Activity:

  1. Get information about job - Orchestrator HTTP Request.
"/odata/Jobs?%24filter=HostMachineName%20eq%20'"+Envirnonment.MachineName+"'%20and%20State%20in%20('Running'%2C'Stopping')&%24select=OrganizationUnitId%2CId%2CStartTime"
  1. From response I would get :
  • StartTime: cdate(J_Job(“value”).First()(“StartTime”))

  • Folder ID: J_Job(“value”).First()(“OrganizationUnitId”)

  • Job ID: J_Job(“value”).First()(“Id”)

  • endpoint: J_Job(“@odata.context”)

    J_Job is var JObject. It was deserialized from Orchestrator HTTP Request response

  1. Next I would send count request:
"/odata/RobotLogs?%24filter=HostMachineName%20eq%20'"+Envirnonment.MachineName+"'%20AND%20TimeStamp%20gt%<STARTTIME>%20&%24top=1&%24count=true"

where <STARTTIME> is value replaced with StartTime taken with the first request

  1. I will get count from second call:
int_Logs = cint(J_Logs("@odata.count"))
  1. I will count pages
int_PageSize = 25 (other possible values - 10 or 50)
Index = if (int_Logs mod int_PageSize = 0,cint(int_Logs /int_PageSize) - 1,cint(Math.Floor(int_Logs/int_PageSize)))
  1. With all that info I will create the link:
<endpoint>jobs/<Job_ID>/logs?tid=1&fid=<Folder_ID>&index=<Index>&size=<Page_Size>

I know that few people were looking for this kind of solution so I share (but it will not work entirely because of the behaviour I described in my question). At least link would be directing to logs of desired job, and I am going to paste index of the page also as an information in mail, so it would be possible to click multiple times to exact page where the log would be displayed.

@loginerror - tag for taking attention :wink:

Thank you for your feedback @Yameso
I passed it on to our team.

In the meantime, I suppose using Orchestrator API would be the workaround here (and viewing this data in another place).
I am saying that because it looks like clicking to navigate to the new page adds the skip parameter to the underlying query (when browsing the API calls in the network tab), but the moment you refresh it (which happens when you change the index in the URL), the very first request will always be without that skip parameter.

/odata/RobotLogs?$filter=((...))&$top=10&$skip=30&$orderby=TimeStamp%20desc

vs

/odata/RobotLogs?$filter=((...))&$top=10&$orderby=TimeStamp%20desc

Hi. It is workaround. I could even take those logs and show them in mail directly. But…

If I do that, then every error will trigger those api callls. It would be quite big for environment and I am afraid of database.

Thats why I prefer to do those 2 requests mentioned above. One is just chceking a job (just one response) and another one is just counting logs without returning values.

I am sure that url edit option (changing index in url) was available in older Orchestrator versions.
To summarize - UI option for redirecting to specfic log page (and jobs or other) would be really appreciated :wink:

1 Like