Hi,
I have two IIS logfiles. I am searching a string name: “externalsystemorderservice” and convertin those IISlogfiles to CSV files.
$log = Get-ChildItem -Path C:\Temp\Test\0.log
$col = {@()}.invoke()
switch -Regex -File $log
{
‘#Fields.*’ {$fields = $_}
‘\d+.externalsystemorderservice.’ {$col.add($Matches[0])}
}
$fields = $fields -replace ‘#Fields:’
$fields = $fields.trim() -split ’ ’
$col -replace ’ ‘,’,’ | convertfrom-csv -Header $fields |
Export-Csv -Path C:\Temp\Test\0.csv -NoTypeInformation
The same way, I am doing for other logfile as-well.
Problem is, I have common fields in both CSV files & that needs to be merged & come as third CSV file.
Common fields: date,time,s-computername,s-ip,time-taken.
-Kalyan