Skip to content

Instantly share code, notes, and snippets.

@justincy
Created December 10, 2012 21:12
Show Gist options
  • Save justincy/4253465 to your computer and use it in GitHub Desktop.
Save justincy/4253465 to your computer and use it in GitHub Desktop.
Filter out stacktraces from a logfile and format them nicely
$inputfile = "C:\path\to\logfile.log"
$outputfile = "C:\path\to\output.log"
$stacktraces = get-content $inputfile | where { $_ -like '{*' } | get-unique
new-item $outputfile -type file -force
foreach($st in $stacktraces) {
add-content $outputfile (ConvertFrom-Json $st).stacktrace
add-content $outputfile "`r`n===========================================================================`r`n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment