Listing and filtering IIS Logs in Powershell

From Tech-Wiki
Revision as of 15:51, 2 November 2023 by Fabricio.Lima (Talk | contribs) (Created page with "Category:Microsoft '''Back to Windows 7''' Parser and filter for IIS logs $LogFiles = "C:\InetPub\Logs\LogFiles\W3SVC1\" $Headers = @((Get-Co...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to Windows 7


Parser and filter for IIS logs

$LogFiles = "C:\InetPub\Logs\LogFiles\W3SVC1\"
$Headers = @((Get-Content -Path (Get-ChildItem -Path $LogFiles -Filter '*.log').FullName -ReadCount 4 -TotalCount 4)[3].split(' ') | Where-Object { $_ -ne '#Fields:' });
Import-Csv -Delimiter ' ' -Header $Headers (Get-ChildItem -Path $LogFiles -Filter '*.log').FullName | Where-Object { $_.date -notlike '#*' } | Out-GridView -Title "IIS logs $LogFiles";