scripts icon indicating copy to clipboard operation
scripts copied to clipboard

Get-IisLog.ps1 should wait for new log entries if -Before is omitted

Open brianary opened this issue 7 years ago • 0 comments

The IIS Log parsing script should allow the -Before parameter to be omitted, and watch for (and filter) new log entries.

This could use Get-Content -Wait (like tail -f on Linux) on the most recent file instead of using LogParser (which it would still do for older files), but that has some complications:

  • the #Fields: line would have to be parsed by powershell unless it could be piped to LogParser (does LogParser wait for EOF to output things)
  • the "like" operator pattern would have to be translated from LogParser SQL to PowerShell's syntax (%* and _?, with LogParser's built-in escape character \, which isn't overridable like standard SQL)
  • once a new file is created, watching the previous one must end, and watching the new one must begin (this one is hardest, and may require multiple threads or processes or workflows or something)

brianary avatar Jul 05 '18 16:07 brianary