From: Stefan Chivu Date: Wed, 15 Feb 2023 08:42:08 +0000 (+0000) Subject: ceph-windows: Fixed txt event log dump X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=84bb2695d7deaffcaed2b731f50a6b81b26c2e5f;p=ceph-build.git ceph-windows: Fixed txt event log dump The event log collection script was throwing an error if no event logs could be found for the filters applied. Therefore, the Get-WinEvent call in DumpEventLogTxt has been modified to silently continue if such case arises. Signed-off-by: Stefan Chivu --- diff --git a/scripts/ceph-windows/collect-event-logs.ps1 b/scripts/ceph-windows/collect-event-logs.ps1 index de870aeb..ffdb123f 100644 --- a/scripts/ceph-windows/collect-event-logs.ps1 +++ b/scripts/ceph-windows/collect-event-logs.ps1 @@ -26,7 +26,13 @@ function DumpEventLogTxt($path){ $logName = $logName.replace(" ","-").replace("/", "-").replace("\", "-") Write-Output "exporting "$i.LogName" as "$logName $logFile = Join-Path $path $logName - Get-WinEvent -FilterHashtable @{LogName=$i.LogName;StartTime=$(Get-Date).AddHours(-24)} | Format-Table -AutoSize -Wrap > $logFile + Get-WinEvent ` + -ErrorAction SilentlyContinue ` + -FilterHashtable @{ + LogName=$i.LogName; + StartTime=$(Get-Date).AddHours(-6) + } | ` + Format-Table -AutoSize -Wrap > $logFile } }