$targetTs = "2026-05-20 02:20:00" $kws = @( 'print-retry-compensation', 'print_retry_compensation\.js', 'retryFailed', '触发补打', '任务执行完成', '/__schedule\?path=D:\\wms\\app\\schedule\\print_retry_compensation\.js' ) $results = New-Object System.Collections.Generic.List[string] Get-ChildItem logs/wms/wms-web.log* | ForEach-Object { $fileName = $_.Name $fs = New-Object System.IO.FileStream($_.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite) $reader = New-Object System.IO.StreamReader($fs) while($null -ne ($line = $reader.ReadLine())){ if($line -match '^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})'){ $ts = $matches[1] if($ts -ge $targetTs){ foreach($k in $kws){ if($line -match $k){ $results.Add("$($fileName): $($line)") break } } } } } $reader.Close() $fs.Dispose() } $results | ForEach-Object { Write-Output $_ }