I am currently helping a customer migrate from Novell to Microsoft and they are using the Quest migrator product to move their data to new DFS servers.
They currently have a large amount of data stored on a number of volumes. The sheer number of volumes and data have required that they deploy a large number of the copy engine servers.
The copy engine does not utilize a central logging facility, it stores the logfiles in a folder alongside the copy engine.
This unfortunately has a side affect, that there are now quite a few log files and some are reaching over 1.5GB in size.
Trying to load these files into a text editor as proven impossible and unworkable and another way was needed.
I decided that the best way to achieve this was to use a script that would parse the log files and extract the errors from the files into another file that would be smaller and easier to work with.
I decided to use Powershell as the scripting language as it would run on the new infrastructure and could be run on a copy engine server with enough disk space.
I undertook quite a bit of research and trial and error but eventually I have a working script.
This script is not signed so you will either need to sign the script to run it or elevate the privileges with set-Executionpolicy on the system you are going to be using.
The script uses two files the main script file and a csv file with the volume names and copy engine server names.
Below you will find a copy of both. I have also created a git repository that you can find on GitHub if you would like to help make it better
Original PowerShell Script
# Quest Migrator Logfile Parser
$d = Get-Date
$logFileRPath = "D:Logslogs"
$logFilePath = "D:Logs"
$logFileEPath = "D:Logserrors"
$logFileDate = $d.Day - 1
$logFiles = Get-ChildItem $logFileRPath | where { $_.LastWriteTime.Day -eq $logFileDate}
# Add more copy machines to the file below.
$copyServers = Import-Csv $logFilePathqmcopyservers.csv
#Write-Host "LogDate Is" $logFileDate
Write-Host
Write-Host "Copy Servers To Use"
foreach ($server in $copyServers) {
$copyMachine = $server.CopyMachine
$copyVolume = $server.Volume
$sourcePath = "\$copyMachinendsmigLogsFile Migration"
Write-Host $copyMachine
#Write-Host $sourcePath
$sourceLog = Get-ChildItem $sourcePath*Scan.log | where { $_.LastWriteTime.Day -eq $logFileDate}
#Write-Host $sourceLog.LastWriteTime
Copy-Item -path $sourceLog -destination $logFileRPath"$copyVolume"-Scan.log
}
Write-Host
Write-Host "Log Files Selected"
foreach ($logFile in $logFiles) {
#Write-Host $logFile
}
Write-Host
foreach ($objFile in $logFiles)
{
Write-Host "Processing LogFile" $objFile
gc $logFileRPath$objFile -read 10000 | %{$_} | ? {$_ -like '*Error *'} | Out-File $logFileEPath"$objFile"-errors.log
}
Original CSV File
Volume, CopyMachine
NWVOLUME1,COPYMACHINE1
NWVOLUME2,COPYMACHINE2
NWVOLUME3,COPYMACHINE3
NWVOLUME4,COPYMACHINE4
NWVOLUME5,COPYMACHINE5