Using ishRemote, how can I get the DITA OT log file contents in a Get-IshEvent request?

I wrote this little PowerShell routine to get the log for a specific event. I can get the detail, but I cannot figure out how to get the contents of the DITA-OT log file. Can you help me?

I tried looking at IshEventData for the DITAOTLogFile event but the byte array is 0 in length.

$targetServer = "">www.example.com/.../"

if($ishSession -eq $null) {
$ishSession = New-IshSession -WsBaseUrl $targetServer
}

$requestedMetadata = Set-IshRequestedMetadataField -IshSession $ishSession -Name "EVENTID" -Level "Progress" |
Set-IshRequestedMetadataField -IshSession $ishSession -Name "EVENTTYPE" -Level "Progress" |
Set-IshRequestedMetadataField -IshSession $ishSession -Name "EVENTDATATYPE" -Level "Detail" |
Set-IshRequestedMetadataField -IshSession $ishSession -Name "DETAILID" -Level "Detail"

$metadataFilter = Set-IshMetadataFilterField -IshSession $ishSession -Name "DESCRIPTION" -Level "Progress" -FilterOperator Like -Value "Publish process for GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx=3=HTMLOutput=en-us"

$eventLog = Get-IshEvent -IshSession $ishSession -RequestedMetadata $requestedMetadata -EventTypes "PUBLISH" -MetadataFilter $metadataFilter

$eventLog
emoji
Parents
  • Hi Colin, I wrote the below in my shortened lunch break ;)

    I hope the below gets you started. The one thing to imagine is that events have a hierarchy (like Logical-Version-Language). It goes from Progress, which has multiple Detail levels, and then there are some Detail levels with a DataType, that have a leaf level called Data (the binary thing, file attached). So in the below sample will retrieve the binary attached to DITAOTLogFile (a Detail that typically only exists once in a full Progress).

    $requestedMetadata = Set-IshMetadataField -Level Detail -Name EVENTDATATYPE |
                         Set-IshMetadataField -Level Detail -Name EVENTDATASIZE
    $metadataFilter = Set-IshMetadataFilterField -Level Progress -Name DESCRIPTION -FilterOperator Equal -Value "Publish process for GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx=1=PDF (XPP A4)=en-us" |
                      Set-IshMetadataFilterField -Level Detail -Name EVENTDATATYPE -FilterOperator Equal -Value "DITAOTLogFile"
    $e= Get-IshEvent -ModifiedSince (Get-Date).AddDays(-30) -EventTypes "PUBLISH" -MetadataFilter $metadataFilter -RequestedMetadata $requestedMetadata
    
    # there is however no cmdlet to retrieve the binary Data part directly; you can use the Soap proxies to achieve this
    # preferably chunked retrival if larger than 100000 to avoid memory pressure, to simplify the sample asked for the full eventdatasize in one request
    $etNextEventDetailDataChunkRequest = New-Object -TypeName Trisoft.ISHRemote.EventMonitor25ServiceReference.GetNextEventDetailDataChunkRequest -ArgumentList @($e.DetailRef, '0', $e.eventdatasize_detail_value)
    $byteArray = ($ishSession.EventMonitor25.GetNextEventDetailDataChunk($etNextEventDetailDataChunkRequest)).bytes
    $string = [System.Text.Encoding]::UTF8.GetString($byteArray)

    Best wishes,
    Dave

    emoji
Reply
  • Hi Colin, I wrote the below in my shortened lunch break ;)

    I hope the below gets you started. The one thing to imagine is that events have a hierarchy (like Logical-Version-Language). It goes from Progress, which has multiple Detail levels, and then there are some Detail levels with a DataType, that have a leaf level called Data (the binary thing, file attached). So in the below sample will retrieve the binary attached to DITAOTLogFile (a Detail that typically only exists once in a full Progress).

    $requestedMetadata = Set-IshMetadataField -Level Detail -Name EVENTDATATYPE |
                         Set-IshMetadataField -Level Detail -Name EVENTDATASIZE
    $metadataFilter = Set-IshMetadataFilterField -Level Progress -Name DESCRIPTION -FilterOperator Equal -Value "Publish process for GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx=1=PDF (XPP A4)=en-us" |
                      Set-IshMetadataFilterField -Level Detail -Name EVENTDATATYPE -FilterOperator Equal -Value "DITAOTLogFile"
    $e= Get-IshEvent -ModifiedSince (Get-Date).AddDays(-30) -EventTypes "PUBLISH" -MetadataFilter $metadataFilter -RequestedMetadata $requestedMetadata
    
    # there is however no cmdlet to retrieve the binary Data part directly; you can use the Soap proxies to achieve this
    # preferably chunked retrival if larger than 100000 to avoid memory pressure, to simplify the sample asked for the full eventdatasize in one request
    $etNextEventDetailDataChunkRequest = New-Object -TypeName Trisoft.ISHRemote.EventMonitor25ServiceReference.GetNextEventDetailDataChunkRequest -ArgumentList @($e.DetailRef, '0', $e.eventdatasize_detail_value)
    $byteArray = ($ishSession.EventMonitor25.GetNextEventDetailDataChunk($etNextEventDetailDataChunkRequest)).bytes
    $string = [System.Text.Encoding]::UTF8.GetString($byteArray)

    Best wishes,
    Dave

    emoji
Children
No Data