Skip to content

ddneves/LogFileParser

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

LogFileParser

Gathers a defined subset of logs and creates a queryable class for it.

Examples

Dot Sourcing

. 'C:\OneDrive## Sources\Git\LogFileParser\LogFileParser.ps1'

loading complete directory recursive

$newLogParser = [LogFileParser]::new('C:\OneDrive## Sources\Git\DemoLogs')

loading a specific file

$newLogParser = [LogFileParser]::new('C:\OneDrive## Sources\Git\DemoLogs\DISM\dism.log')
$newLogParser = [LogFileParser]::new('C:\OneDrive## Sources\Git\DemoLogs\CBS\cbs.log')
$newLogParser = [LogFileParser]::new('C:\OneDrive## Sources\Git\DemoLogs\Upgrade\setupact.log')
$newLogParser = [LogFileParser]::new('C:\OneDrive## Sources\Git\DemoLogs\Upgrade\setuperr.log')
$newLogParser = [LogFileParser]::new('C:\OneDrive## Sources\Git\DemoLogs\SCCM\ccmexec.log')

information of actual data

$newLogParser $newLogParser.ParsedLogFiles $newLogParser.ParsedLogFiles | Select-Object LogFilePath, LogFileType

show data

$newLogParser.ParsedLogFiles[0].ParsedLogData

columns of data, which can be used for conditions

$newLogParser.ParsedLogFiles[0].GetColumnNames()

gather only rows, which contain errors and show them

($newLogParser.ParsedLogFiles[0].ParsedLogData).Where{$_.Entry -like 'error'} | Out-GridView

Row conditions

($newLogParser.ParsedLogFiles[0].ParsedLogData).Where{ $.RowNum -gt 500 -and $.RowNum -lt 510 }

Time conditions

($newLogParser.ParsedLogFiles[0].ParsedLogData)[0].Time

last 2 days

($newLogParser.ParsedLogFiles[0].ParsedLogData).Where{ $_.DateTime -gt ([DateTime]::Now).AddDays(-2) }

gather only rows, which contain errors and show also all 20 lines bnefore and after the error-lines

$LinesWithErrors = (($newLogParser.ParsedLogFiles[0].ParsedLogData).Where{$.Entry -like 'error'}).RowNum $RowList = Get-RowNumbersInRange -RowNumbers $LinesWithErrors -Range 20 ($newLogParser.ParsedLogFiles[0].ParsedLogData).Where{$.RowNum -in $RowList} | Out-GridView

About

Gathers a defined subset of various logs and highlights important lines.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published