Page History
...
JS7 does not make use of files for log output of order logs and task logs, see JS7 - Order Logs and Task Logs. JS7 instead Instead, JS7 streams log output from Agents to the Controller and to the JOC Cockpit without use of files.
...
To support a situation when log output should be consolidated to files the , the JS7 - REST Web Service API allows access to log output of orders and jobs. The JS7 - PowerShell Module is a lightweight wrapper for the REST Web Service API that which is used for the examples below examples with Linux and Windows. Users are free to use the JS7 REST Web Service from their preferred scripting language to provide similar functionality.
...
- The
Get-JS7TaskHistory
cmdlet returns history results that which can be filtered by folders, workflows, date range, jobs , - see the cmdlet description. By default today's task executions are returned. - The
Get-JS7TaskLog
cmdlet is used in a pipeline and returns the task log object for each history entry. - As a result the
$logs
array holds will hold the list of task log objects.
...
A task log object carries a number of attributes as visible from shown in the following console example:
...
Reads the logs of tasks that have completed within the last 8 hours and writes the log output to individual files in the
/tmp
directory.The log file names are created from the start time and from the job name of each task.
...
Provides a mechanism to subsequently retrieve previous logs. Starting from initial execution of the
Get-JS7TaskHistory
cmdlet, the resulting$lastHistory
object is used for any subsequent calls.
Consider use of theTee-Object
cmdlet in the pipeline that updates the$lastHistory
object that which can be used for later executions of the same pipeline.This pipeline can e.g. be executed in a cyclic job.
...
- Line 1: The shebang is required to identify PowerShell being the interpreter of the script. The above example is for Unix, for Windows the first line of the job script should be replaced as follows:
Code Block language powershell title Example of shebang for PowerShell with Unix linenumbers true #!/usr/bin/env pwsh
Code Block language powershell title Example of shebang for PowerShell with Windows linenumbers true @@findstr/v "^@@f.*&" "%~f0"|pwsh.exe -&goto:eof
- Line 4: The are a number of ways how to specify of specifying details for a JS7 connection, see seethe JS7 - How to connect to JOC Cockpit using the PowerShell Module article.
- The host and port are specific for a user's environment.
- The Controller ID is specified during installation of the Controller and defaults to
Controller
.
- Line 9:
- A workflow variable is created that which carries the list of task log objects returned by
the Get-JS7TaskHistory
cmdlet for which task logs should be created. This variable is in fact a PowerShell object that is serialized to JSON and prefixed with the stringjson:
for later use with the second job in the workflow.
...