Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # remove old files
- if (test-path "counters.txt" ) { Remove-Item "counters.txt" }
- if (Test-Path "counters_filtered.txt" ) { Remove-Item "counters_filtered.txt" }
- if (Test-Path "allday.blg" ) { Remove-Item "allday.blg" }
- $files = ls -Filter *.blg
- $arguments = ""
- foreach ($file in $files)
- {
- write-host $file.Name
- $arguments += "$($file.name) "
- }
- $arguments += "-o allday.blg"
- # combine all files
- Write-Host "** Combining all logs"
- write-host "relog $arguments"
- Start-Process -Wait relog -ArgumentList $arguments
- #relog $arguments
- # query the counters in the file
- Write-Host "** Querying counters"
- relog allday.blg -q -o counters.txt
- # filter only counters needed server1 or server2
- Write-Host "** Filtering counters for only needed servers"
- gc .\counters.txt | where { $_ -ilike "*server1*" } | Out-File -FilePath "counters_filtered.txt" -Append -Encoding ascii
- gc .\counters.txt | where { $_ -ilike "*server2*" } | Out-File -FilePath "counters_filtered.txt" -Append -Encoding ascii
- # strip useless counters from the allday file
- write-host "Creating allday_filtered.blg"
- relog "allday.blg" -cf "counters_filtered.txt" -o "allday_filtered.blg"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement