# # parse-uccapilog # # parse the given UCCAPI-Log to find some information # # Pending: Pipeline input param ( #[string]$path="C:\\AppData\Local\Microsoft\Office\15.0\Lync\Tracing\Lync-UccApi-0.UccApilog" [string]$path="C:\group\Technik\Skripte\parse-uccapilog\Lync-UccApi-0.UccApilog" ) #$pwd.path+"\Lync-UccApi-0.UccApilog" # Look for # 04/16/2013|03:17:30.168 1F68:C14 INFO :: End of Sending Packet - 192.168.100.100:5061 (From Local Address: 192.168.103.35:20323) 1503 bytes # 04/16/2013|03:17:31.555 1F68:C14 INFO :: End of Data Received -192.168.100.100:5061 (To Local Address: 192.168.103.35:20323) 1096 bytes # # Overhead für TCP Sync not added # Overhead für TLS Handshake not included # Overhead für TCP/IP/Ethernet Encapsulation not added # # 20130402 Ver 1.0 Initial Version # 20130421 Ver 1.1 Bugfix timestamp = 0 not handled # 20130424 Ver 1.2 readLines nach ReadAllLines umgestellt um nicht NET4 zu brauchen. Und schneller Write-Host 'parse-uccapilog: ============== started ============== ' Write-Host ' File: ' $path [int]$totalsipin=0 [int]$totalsipout=0 [int]$totalmatch=0 [int]$count=0 [datetime]$now = get-date $error.clear() foreach ($line in ([System.IO.File]::ReadAllLines($path))){ $count+=1 if ($count -eq 1) { [datetime]$starttimestamp= $line.split(" ")[0].replace("|"," ") } if (($count%10000) -eq 0) { write-host " Processing line:"$count } if ($line -like "*INFO :: End of Sending Packet -*") { $totalsipout += ($line.split(" "))[15] $totalmatch+=1 } if ($line -like "*INFO :: End of Data Received -*") { $totalsipin += ($line.split(" "))[14] $totalmatch+=1 } # if ($error) { # $line; break # } } [datetime]$endtimestamp= $line.split(" ")[0].replace("|"," ") [int]$timespan = ($endtimestamp - $starttimestamp).totalseconds if ($timespan -ne 0){ $sipbandwidth = ($totalsipin+$totalsipout) / $timespan * 8 $sipmessagerate = ($totalmatch / $timespan) } else { write-host "WARNING: Timepan = 0, no rate calculated" $sipbandwidth = "Not calculates. timespan = 0 seconds" $sipmessagerate = "Not calculates. timespan = 0 seconds" } write-host "Starttimestamp:" $Starttimestamp write-host "Endtimestamp :" $endtimestamp write-host "TimeSpan :" $timespan write-host "Total Lines :" $count write-host "Total Found :" $totalmatch write-host "Duration (Sec):" ($endtimestamp - $starttimestamp).totalseconds write-host "Duration (Min):" ($endtimestamp - $starttimestamp).totalminutes write-host "SIP in (MB) :" ($totalsipin / 1024 / 1024) write-host "SIP out (MB) :" ($totalsipout / 1024 / 1024) write-host "SIP bit/Sek :" $sipbandwidth write-host "ScriptRunTime (s) :" ((get-date) - $now).totalseconds write-Host "parse-uccapilog: ============== ended ============== "