Versions Compared

Key

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

Name

Get-JS7TaskLog

SYNOPSIS

Read Returns the task log from the JobScheduler JS7 History.

SYNTAX

Get-JS7TaskLog [[-TaskIdControllerId] <String>] [[-JobAgentUrl] <String>] [-TaskId] <String> [[-StartTimeOrderId] <DateTime><String>] [[-EndTimeWorkflow] <DateTime><String>] [[-ExitCodePosition] <Int32><String>] [[-StateJob] <PSObject><String>] [[-Criticality] <String>] [[-ExitCode] <Int32>] [[-JobSchedulerId] <String>State] <PSObject>] [[-StartTime] <DateTime>] [[-ClusterMemberEndTime] <String><DateTime>] [<CommonParameters>]

DESCRIPTION

Reads Returns a task log for a given task Task ID. This cmdlet is mostly used for pipelined input from the
Get-JobSchedulerTaskHistory 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

PARAMETERS

ControllerId

-ControllerId <String>
This parameter is used to accept pipeline input from the Get-JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?1
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

AgentUrl

-AgentUrl <String>
This parameter is used to accept pipeline input from the Get-JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?2
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

TaskId

-TaskId <String>
Specifies the ID that the task was running with. This information is provided by the
Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet.

Required?true
Position?13
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

OrderId

-Job OrderId <String>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?24
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

Workflow

-StartTime <DateTime>Workflow <String>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?35
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

Position

-EndTime <DateTime>Position <String>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?46
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

Job

-ExitCode <Int32>Job <String>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?57
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Criticality

-Criticality <String>
This parameter is used to accept pipeline input from the Get-JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?8
Default value0
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

ExitCode

-State <PSObject>ExitCode <Int32>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?69
Default value0
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

State

-Criticality <String>State <PSObject>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?710
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

StartTime

-JobSchedulerId <String>StartTime <DateTime>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?811
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

EndTime

-ClusterMember <String>EndTime <DateTime>
This parameter is used to accept pipeline input from the Get-JobSchedulerTaskHistory JS7TaskHistory cmdlet and forwards the parameter to the resulting object.

Required?false
Position?912
Default value
Accept pipeline input?true (ByValue, ByPropertyName)
Accept wildcard characters?false

...

-------------------------- EXAMPLE 1 --------------------------

PS > Get-JobSchedulerTaskHistory JS7TaskHistory -Job WorkflowPath /some/product_demo/sample_workflow -Job job174 | Get-JobSchedulerTaskLogJS7TaskLog

Retrieves the most recent task log for the given job.

-------------------------- EXAMPLE 2 --------------------------

PS > Get-JobSchedulerTaskHistory JS7TaskHistory -Job WorkflowPath /some/product_demo/sample_workflow -Job job174 | Get-JobSchedulerTaskLog JS7TaskLog | Out-File /tmp/job174.log -Encoding Unicode

...

-------------------------- EXAMPLE 3 --------------------------

PS > Get-JobSchedulerTaskHistory JS7TaskHistory -RelativeDateFrom -8h | Get-JobSchedulerTaskLog 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.

-------------------------- EXAMPLE 4 --------------------------

PS > # execute once
$lastHistory = Get-JobSchedulerTaskHistory JS7TaskHistory -RelativeDateFrom -8h | Sort-Object -Property startTime
# execute by interval in intervals
Get-JobSchedulerTaskHistory JS7TaskHistory -DateFrom $lastHistory[0].startTime | Tee-Object -Variable lastHistory | Get-JobSchedulerTaskLog 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-JobSchedulerTaskHistory 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.