microsoft / windows-container-tools

Collection of tools to improve the Windows Containers experience
MIT License
240 stars 68 forks source link

Filter file logs #168

Open david-garcia-garcia opened 8 months ago

david-garcia-garcia commented 8 months ago

Currently there is no way to filter File logs. This is possible when using EventLog where you can choose minimum severity for logs that will be processed by LogMonitor. This can easily lead to flooding of non relevant container output when log files are monitored (i.e. IIS logs for requests).

Also, there is no way to distinguish in File based logs wether to write to standard output or standard error, making it difficult to reallly pinpoint when a problem is happening.

Describe the solution you'd like I believe a regex based approach would be the most flexible.

     {
        "type": "File",
        "directory": "c:\\inetpub\\logs",
        "filter": "*.log",
        "includeSubdirectories": true,
        "includeFileNames": false,
        "stdOutMatch": "REGULAR EXPRESSION THAT LOG ENTRIES MUST MATCH TO BE REDIRECTED TO STANDARD OUTPUT",
        "stdErrorMatch": "REGULAR EXPRESSION THAT LOG ENTRIES MUST MATCH TO BE REDIRECTED TO STANDARD ERROR"
      }

Describe alternatives you've considered None.

david-garcia-garcia commented 8 months ago

Unfortunately I haven't touched C/C++ for more than two decades now which makes it difficult to contribute a PR :(