102 lines
2.5 KiB
PowerShell
102 lines
2.5 KiB
PowerShell
function Search-RejkLogfiles {
|
|
param(
|
|
[switch]$APP,
|
|
[switch]$CWS,
|
|
[switch]$BORIS,
|
|
[switch]$BackOffice,
|
|
[switch]$TCS,
|
|
[switch]$TCF,
|
|
[switch]$API,
|
|
|
|
[int]$NewerThanDays = 3,
|
|
|
|
[string]$Pattern
|
|
)
|
|
|
|
$logs = Get-RejkLogfiles -API:$API -APP:$APP -CWS:$CWS -BORIS:$BORIS -BackOffice:$BackOffice -TCS:$TCS -TCF:$TCF -NewerThanDays:$NewerThanDays
|
|
|
|
$logs | Select-String -Pattern $Pattern | Sort-Object Line | Out-GridView -PassThru
|
|
}
|
|
|
|
|
|
|
|
function Get-RejkLogfiles {
|
|
param(
|
|
[switch]$APP,
|
|
[switch]$CWS,
|
|
[switch]$BORIS,
|
|
[switch]$BackOffice,
|
|
[switch]$TCS,
|
|
[switch]$TCF,
|
|
[switch]$API,
|
|
|
|
[int]$NewerThanDays = 3
|
|
)
|
|
|
|
if($NewerThanDays -gt 0) { $NewerThanDays *= -1 }
|
|
|
|
$platform = $env:COMPUTERNAME.Substring('REJK-'.Length, 1)
|
|
$postfix = & {
|
|
switch($platform) {
|
|
'A' { '2{0:d2}' }
|
|
'C' { '3{0:d2}' }
|
|
'E' { '4{0:d2}' }
|
|
'Q' { '1{0:d2}' }
|
|
'P' { '0{0:d2}' }
|
|
}
|
|
}
|
|
|
|
|
|
$logs = & {
|
|
if($APP) {
|
|
1..4 | % {
|
|
$server = ("rejk-$platform-app$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
|
|
if($CWS) {
|
|
5..8 | % {
|
|
$server = ("rejk-$platform-web$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
|
|
if($BORIS) {
|
|
3..4 | % {
|
|
$server = ("rejk-$platform-web$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
|
|
if($BackOffice) {
|
|
1..2 | % {
|
|
$server = ("rejk-$platform-web$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
|
|
if($TCS) {
|
|
1..18 | % {
|
|
$server = ("rejk-$platform-tcs$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
|
|
if($TCF) {
|
|
1..2 | % {
|
|
$server = ("rejk-$platform-tcf$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
|
|
if($API) {
|
|
1..2 | % {
|
|
$server = ("rejk-$platform-api$postfix" -f $_)
|
|
Get-Item "\\$server\d-drive\ifsbosystem\log\*.log*"
|
|
}
|
|
}
|
|
}
|
|
|
|
$logs | where { $_.LastWriteTime -gt (Get-Date).AddDays($NewerThanDays) }
|
|
} |