Difference between revisions of "Listing and filtering IIS Logs in Powershell"
From Tech-Wiki
(Created page with "Category:Microsoft '''Back to Windows 7''' Parser and filter for IIS logs $LogFiles = "C:\InetPub\Logs\LogFiles\W3SVC1\" $Headers = @((Get-Co...") |
|||
Line 1: | Line 1: | ||
[[Category:Microsoft]] | [[Category:Microsoft]] | ||
− | '''[[Microsoft#Windows | + | '''[[Microsoft#Windows Server 2003/2008/20012|Back to Windows Server 2003/2008/20012]]''' |
− | + | ||
Revision as of 15:51, 2 November 2023
Back to Windows Server 2003/2008/20012
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";