41 lines
1.4 KiB
PowerShell
41 lines
1.4 KiB
PowerShell
& {
|
|
# go to these servers
|
|
$servers = 'REJK-P-APP001','REJK-P-APP002','REJK-P-APP003','REJK-P-APP004'
|
|
|
|
# look in these logfiles
|
|
$logfiles = @(
|
|
"\\$server\D-Drive\IFSBOSystem\Log\IndirectTravelCard.Service.log"
|
|
"\\$server\D-Drive\IFSBOSystem\Log\IndirectTravelCard.Service.log.1"
|
|
"\\$server\D-Drive\IFSBOSystem\Log\IndirectTravelCard.Service.log.2"
|
|
"\\$server\D-Drive\IFSBOSystem\Log\IndirectTravelCard.Service.log.3"
|
|
)
|
|
|
|
# First find this
|
|
$matchstring = 'Unexpected Exception in InsertLST.ListManagement.BusinessEntities.ActionReloadTPurseEntity.'
|
|
|
|
# then search backwards for this
|
|
$searchentry = 'InsertLST.ListManagement.BusinessEntities.ActionReloadTPurseEntity:'
|
|
|
|
foreach($server in $servers) {
|
|
foreach($logfile in $logfiles) {
|
|
Write-Host "-- $logfile"
|
|
|
|
$content = Get-Content $logfile
|
|
|
|
for($i = 0; $i -lt $content.Length; $i++) {
|
|
if($content[$i] -match $matchstring) {
|
|
for($y = $i-1; $y -ge 0; $y--) {
|
|
if($content[$y] -match $searchentry) {
|
|
Write-Host $content[$y]
|
|
break
|
|
}
|
|
|
|
if($y -eq 0) { Write-Host "Searchentry not found" }
|
|
}
|
|
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |