Octopus Task log

Hi
I have big deployment process so it difficult to monitor log file on screen. I want to write a script which will capture errors at the end of deployment process from the task log . Is it possible? if yes how i will get the task file name

Hi Prashant,

Thanks for getting in touch!

The best way to do this would be to export the raw task log once the task has been completed. This can be done by following these instructions. If you will be doing this task repeatedly I would recommend using the Octopus REST API to request the information.

The following pages will assist in getting you started with the API:



Please let me know if there are any other issues that you need assistance with,

Regards

Alex

Thanks Alex , could you please confirm log name would be Octopus.Task.Id.log

Hi Prashant,

Be default the log exports with the following naming structure: ServerTasks-(TaskID).log.

For example if I exported the task log for Task-ID 1547 (in my case a retention policy task) it would export as ServerTasks-1547.log

If you have any other questions please let us know,

Regards,

Alex

Thanks Alext , but when I see in C:\octopus\tasklogs it appears as servertasks-11716_brnefk8fvf.txt… what i am interested in capturing “11716_brnefk8fvf” in my script … could you please advise which system variable should i use to capture this part

Hi Prashant,

The logs that you are reading in c:\Octopus\Tasklogs are different than the logs that I recommended you retrieve via the API. To illustrate the difference I have attached the same log, one the raw log exported from Octopus, the other located in c:\Octopus\Tasklogs. As you can see the raw export provides more information in better formatting.

As for the string of characters in the filename of the logs in the Tasklogs directory, they are randomly generated and are not able to be retrieved programatically. You should still be able to retrieve these files by matching the first part of the filename as that will be consistent, however I would recommend using the API/Raw log method as the API is fully supported and tested against new versions.

I hope that assists,

Regards
Alex

ServerTasks-1547.log.txt (8 KB)

servertasks-1547_mw6jtz8k8s.txt (12 KB)