Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Returns a task log for a given task Task ID. This cmdlet is mostly used for pipelined input from the
Get-JS7TaskHistory cmdlet that allows to search the execution history of tasks and
that returns task IDs that are used by this cmdlet to retrieve the task's log output.

The following REST Web Service API resources are used:

* /task/log/download

...

PS > Get-JS7TaskHistory -RelativeDateFrom -8h | Get-JS7TaskLog | Select-Object @{name='path'; expression={ "/tmp/history/$(Get-Date $_.startTime -f 'yyyyMMdd-hhmmss')-$([io.path]::GetFileNameWithoutExtension($_.job)).log"}}, @{name='value'; expression={ $_.log }} | Set-Content

Read Reads the logs of tasks that completed within the last 8 hours and writes the log output to individual files. The log file names are created from the start time and the job name of each task.

...

PS > # execute once
$lastHistory = Get-JS7TaskHistory -RelativeDateFrom -8h | Sort-Object -Property startTime
# execute by intervalin intervals
Get-JS7TaskHistory -DateFrom $lastHistory[0].startTime | Tee-Object -Variable lastHistory | Get-JS7TaskLog | Select-Object @{name='path'; expression={ "/tmp/history/$(Get-Date $_.startTime -f 'yyyyMMdd-hhmmss')-$([io.path]::GetFileNameWithoutExtension($_.job)).log"}}, @{name='value'; expression={ $_.log }} | Set-Content

Provides a mechanism to subsequently retrieve previous logs. Starting from intial initial execution of the Get-JS7TaskHistory cmdlet the resulting $lastHistory object is used for any subsequent calls. Consider use of the Tee-Object cmdlet in the pipeline that updates the $lastHistory object that can be used for later executions of the same pipeline. The pipeline can e.g. be executed in a cyclic job.