How to troubleshoot applications on Windows Containers with the Log Monitor tool

Published Mar 08 2022 03:00 AM 2,682 Views

In my previous blog post, I showed how to manually troubleshoot Windows Containers by opening an interactive session to a container, running a PowerShell session, and using the Get-WinEvent cmdlet to view the application logs on the container instance. While knowing how that process works is extremely important to understand how to troubleshoot an application on Windows containers, it is not very convenient and doesn’t scale very well. Also, as I mentioned in that blog post, you might not even have access to the container host in some cases. We’ll get to those in a future blog post, but for now, I wanted to show a different tool that can help you in troubleshooting an application on Windows Containers.

 

Why do we even need the Log Monitor tool?

Windows and Linux have different ways to store and present logs and events to its users. Traditionally, Windows has been using the EVT format that can be viewed on a structured way in Event Viewer. On the other hand, Linux has provided a streamlined approach with Standard Output (stdout) that other tools, such as Docker, rely upon.

Docker has always had a mechanism to extract logs from a Linux containers via the “docker logs” command. That command has a default stdout configuration that brings the application logs out of the container without the need to open the container interactively – like we shown in the previous blog post. However, that did not work on Windows until the launch of the Log Monitor tool.

 

In a nutshell, the Log Monitor tool presents the Windows logs in the stdout format so other tools, such as Docker, can gather the information necessary to display it. However, the benefits are not limited to that.

 

Here are a few of the benefits of the Log Monitor tool:

  • You can filter which types of events/logs you want the Log Monitor tool to expose on stdout. For example, you can filter the application log for “error” and “warning” messages only – in case you’re not interested on “information” events.
  • You can choose from Event Logs, Custom Log Files, or Event Tracing for Windows (ETW). This is particularly helpful if your application is writing on a different log source. An example of this is the IIS logs located on the “C:\inetpub” folder.
  • Other tools that look for stdout and interact with the container runtime can leverage the fact that Windows Containers are behaving much like a Linux Container. For example, if you move from Docker to ContainerD as the container runtime, the logs should still be visible from the container host via (for example) “crictl logs”.

How to use the Log Monitor tool

In order to collect the logs from the Windows container instance and then pass that to stdout, the Log Monitor tool needs to be instructed on what is its source and what filters to apply. By default, the tool expects a “LogMonitorConfig.json” file alongside its executable. Here’s the step by step to get started with some samples:

 

Create a JSON file with the Log Monitor configuration

In our example, we are going to monitor an IIS instance. Here is a sample file that can be used for that purpose:

 

{
    "LogConfig": {
      "sources": [
        {
          "type": "EventLog",
          "startAtOldestRecord": true,
          "eventFormatMultiLine": false,
          "channels": [
            {
              "name": "application",
              "level": "Warning"
            },
            {
              "name": "application",
              "level": "Error"
            }
          ]
        },
        {
          "type": "File",
          "directory": "c:\\inetpub\\logs",
          "filter": "*.log",
          "includeSubdirectories": true
        },
        {
          "type": "ETW",
          "eventFormatMultiLine": false,
          "providers": [
            {
              "providerName": "IIS: WWW Server",
              "providerGuid": "3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83",
              "level": "Information"
            },
            {
              "providerName": "Microsoft-Windows-IIS-Logging",
              "providerGuid": "7E8AD27F-B271-4EA2-A783-A47BDE29143B",
              "level": "Information"
            }
          ]
        }
      ]
    }
  }

 

 

The example above uses the three options the Log Monitor tool can have as source. The first option is the Event Log just like you see on Event Viewer. However, we have filtered for Warnings and Errors only. The next one is a file type, and in this case we’ll use the IIS logs file. Finally, we’ll use the ETW option to get real-time events from the IIS providers. (If you don’t know which ETW provider you’re looking for, you can use the Get-ETWTraceProvider cmdlet on PowerShell. It displayes the information you’ll need from the available ETW providers on that machine.)

You can save this file as “LogMonitorConfig.json” on the same folder you’ll build your container image.

 

Build a new container image with Log Monitor and its config

Next, you’ll need to build the image with the Log Monitor tool. Here’s a sample docker file to build an image based on the IIS base container image:

 

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2022
WORKDIR /LogMonitor
COPY LogMonitorConfig.json .
RUN powershell.exe -command wget -uri https://github.com/microsoft/windows-container-tools/releases/download/v1.1/LogMonitor.exe -outfile LogMonitor.exe
# Change the startup type of the IIS service from Automatic to Manual
RUN sc config w3svc start=demand
# Enable ETW logging for Default Web Site on IIS
RUN c:\windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites /"[name='Default Web Site'].logFile.logTargetW3C:"File,ETW"" /commit:apphost
EXPOSE 80
# Start "C:\LogMonitor\LogMonitor.exe C:\ServiceMonitor.exe w3svc"
ENTRYPOINT ["C:\\LogMonitor\\LogMonitor.exe", "C:\\ServiceMonitor.exe", "w3svc"]

 

 

The docker file above uses the LTSC 2022 base container image with IIS installed, copy the json file we just built, downloads the Log Monitor tool from GitHub (you can download it separately if you prefer), then configures IIS so the Log Monitor tool would be able to get the ETW providers its preconfigured to, and finally it configures the Log Monitor tool as the entry point for the container.

 

With the docker file above also on the same location of your json file and the app you want to try out (in case you have one), you can run the below command to build an image:

 

docker build -t testapp:v1 .

 

 

Next, we can run the container to try out the web page:

 

docker run -d -p 8080:80 --name testcontainer testapp:v1

 

 

The command above will start a container that will have its port 80 mapped to the port 8080 on the container host. Now, open a web browser and try to access http://localhost:8080. If you did not deploy a different application, this will open the IIS splash screen from inside the container.

 

Use Docker Logs to retrieve the logs from the container

Now we can use the docker logs command to see what’s happening inside the container:

 

docker logs testcontainer

 

 

The output of the command above might be short or very long depending on how many events you filtered or chose to show or not. Here’s what I got from my test environment:

LogMonitorTool01.png

On the above, I’m highlighting that the logs shown in the output provide the details on the visitor (myself) to the website we’re monitoring. The same way, the logs would have shown other errors related to my application.

 

Conclusion

The Log Monitor tool is a great tool to get Windows Event, log files, and ETW into stdout, which is the standard format for containers. There are many ways to filter the source of your logs and you can make it work with your own application.

 

On the next blogs in the series, we’ll start exploring ways to make this process less manual and more efficient. Let me know what you think of this series so far in the comments section.

 

 

2 Comments
%3CLINGO-SUB%20id%3D%22lingo-sub-3201318%22%20slang%3D%22en-US%22%3EHow%20to%20troubleshoot%20applications%20on%20Windows%20Containers%20with%20the%20Log%20Monitor%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3201318%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20my%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fitops-talk-blog%2Fhow-to-manually-troubleshoot-applications-on-windows-containers%2Fba-p%2F3160832%22%20target%3D%22_blank%22%3Eprevious%20blog%20post%3C%2FA%3E%2C%20I%20showed%20how%20to%20manually%20troubleshoot%20Windows%20Containers%20by%20opening%20an%20interactive%20session%20to%20a%20container%2C%20running%20a%20PowerShell%20session%2C%20and%20using%20the%20Get-WinEvent%20cmdlet%20to%20view%20the%20application%20logs%20on%20the%20container%20instance.%20While%20knowing%20how%20that%20process%20works%20is%20extremely%20important%20to%20understand%20how%20to%20troubleshoot%20an%20application%20on%20Windows%20containers%2C%20it%20is%20not%20very%20convenient%20and%20doesn%E2%80%99t%20scale%20very%20well.%20Also%2C%20as%20I%20mentioned%20in%20that%20blog%20post%2C%20you%20might%20not%20even%20have%20access%20to%20the%20container%20host%20in%20some%20cases.%20We%E2%80%99ll%20get%20to%20those%20in%20a%20future%20blog%20post%2C%20but%20for%20now%2C%20I%20wanted%20to%20show%20a%20different%20tool%20that%20can%20help%20you%20in%20troubleshooting%20an%20application%20on%20Windows%20Containers.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EWhy%20do%20we%20even%20need%20the%20Log%20Monitor%20tool%3F%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EWindows%20and%20Linux%20have%20different%20ways%20to%20store%20and%20present%20logs%20and%20events%20to%20its%20users.%20Traditionally%2C%20Windows%20has%20been%20using%20the%20EVT%20format%20that%20can%20be%20viewed%20on%20a%20structured%20way%20in%20Event%20Viewer.%20On%20the%20other%20hand%2C%20Linux%20has%20provided%20a%20streamlined%20approach%20with%20Standard%20Output%20(stdout)%20that%20other%20tools%2C%20such%20as%20Docker%2C%20rely%20upon.%3C%2FP%3E%0A%3CP%3EDocker%20has%20always%20had%20a%20mechanism%20to%20extract%20logs%20from%20a%20Linux%20containers%20via%20the%20%E2%80%9Cdocker%20logs%E2%80%9D%20command.%20That%20command%20has%20a%20default%20stdout%20configuration%20that%20brings%20the%20application%20logs%20out%20of%20the%20container%20without%20the%20need%20to%20open%20the%20container%20interactively%20%E2%80%93%20like%20we%20shown%20in%20the%20previous%20blog%20post.%20However%2C%20that%20did%20not%20work%20on%20Windows%20until%20the%20launch%20of%20the%20Log%20Monitor%20tool.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20a%20nutshell%2C%20the%20Log%20Monitor%20tool%20presents%20the%20Windows%20logs%20in%20the%20stdout%20format%20so%20other%20tools%2C%20such%20as%20Docker%2C%20can%20gather%20the%20information%20necessary%20to%20display%20it.%20However%2C%20the%20benefits%20are%20not%20limited%20to%20that.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20are%20a%20few%20of%20the%20benefits%20of%20the%20Log%20Monitor%20tool%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EYou%20can%20filter%20which%20types%20of%20events%2Flogs%20you%20want%20the%20Log%20Monitor%20tool%20to%20expose%20on%20stdout.%20For%20example%2C%20you%20can%20filter%20the%20application%20log%20for%20%E2%80%9Cerror%E2%80%9D%20and%20%E2%80%9Cwarning%E2%80%9D%20messages%20only%20%E2%80%93%20in%20case%20you%E2%80%99re%20not%20interested%20on%20%E2%80%9Cinformation%E2%80%9D%20events.%3C%2FLI%3E%0A%3CLI%3EYou%20can%20choose%20from%20Event%20Logs%2C%20Custom%20Log%20Files%2C%20or%20Event%20Tracing%20for%20Windows%20(ETW).%20This%20is%20particularly%20helpful%20if%20your%20application%20is%20writing%20on%20a%20different%20log%20source.%20An%20example%20of%20this%20is%20the%20IIS%20logs%20located%20on%20the%20%E2%80%9CC%3A%5Cinetpub%E2%80%9D%20folder.%3C%2FLI%3E%0A%3CLI%3EOther%20tools%20that%20look%20for%20stdout%20and%20interact%20with%20the%20container%20runtime%20can%20leverage%20the%20fact%20that%20Windows%20Containers%20are%20behaving%20much%20like%20a%20Linux%20Container.%20For%20example%2C%20if%20you%20move%20from%20Docker%20to%20ContainerD%20as%20the%20container%20runtime%2C%20the%20logs%20should%20still%20be%20visible%20from%20the%20container%20host%20via%20(for%20example)%20%E2%80%9Ccrictl%20logs%E2%80%9D.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EHow%20to%20use%20the%20Log%20Monitor%20tool%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20order%20to%20collect%20the%20logs%20from%20the%20Windows%20container%20instance%20and%20then%20pass%20that%20to%20stdout%2C%20the%20Log%20Monitor%20tool%20needs%20to%20be%20instructed%20on%20what%20is%20its%20source%20and%20what%20filters%20to%20apply.%20By%20default%2C%20the%20tool%20expects%20a%20%E2%80%9CLogMonitorConfig.json%E2%80%9D%20file%20alongside%20its%20executable.%20Here%E2%80%99s%20the%20step%20by%20step%20to%20get%20started%20with%20some%20samples%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ECreate%20a%20JSON%20file%20with%20the%20Log%20Monitor%20configuration%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20our%20example%2C%20we%20are%20going%20to%20monitor%20an%20IIS%20instance.%20Here%20is%20a%20sample%20file%20that%20can%20be%20used%20for%20that%20purpose%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%20%20%22LogConfig%22%3A%20%7B%0A%20%20%20%20%20%20%22sources%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22EventLog%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22startAtOldestRecord%22%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%20%22eventFormatMultiLine%22%3A%20false%2C%0A%20%20%20%20%20%20%20%20%20%20%22channels%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22application%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22level%22%3A%20%22Warning%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22application%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22level%22%3A%20%22Error%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22File%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22directory%22%3A%20%22c%3A%5C%5Cinetpub%5C%5Clogs%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22filter%22%3A%20%22*.log%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22includeSubdirectories%22%3A%20true%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22ETW%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22eventFormatMultiLine%22%3A%20false%2C%0A%20%20%20%20%20%20%20%20%20%20%22providers%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22providerName%22%3A%20%22IIS%3A%20WWW%20Server%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22providerGuid%22%3A%20%223A2A4E84-4C21-4981-AE10-3FDA0D9B0F83%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22level%22%3A%20%22Information%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22providerName%22%3A%20%22Microsoft-Windows-IIS-Logging%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22providerGuid%22%3A%20%227E8AD27F-B271-4EA2-A783-A47BDE29143B%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22level%22%3A%20%22Information%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20example%20above%20uses%20the%20three%20options%20the%20Log%20Monitor%20tool%20can%20have%20as%20source.%20The%20first%20option%20is%20the%20Event%20Log%20just%20like%20you%20see%20on%20Event%20Viewer.%20However%2C%20we%20have%20filtered%20for%20Warnings%20and%20Errors%20only.%20The%20next%20one%20is%20a%20file%20type%2C%20and%20in%20this%20case%20we%E2%80%99ll%20use%20the%20IIS%20logs%20file.%20Finally%2C%20we%E2%80%99ll%20use%20the%20ETW%20option%20to%20get%20real-time%20events%20from%20the%20IIS%20providers.%20(If%20you%20don%E2%80%99t%20know%20which%20ETW%20provider%20you%E2%80%99re%20looking%20for%2C%20you%20can%20use%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fpowershell%2Fmodule%2Feventtracingmanagement%2Fget-etwtraceprovider%3Fview%3Dwindowsserver2022-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGet-ETWTraceProvider%3C%2FA%3E%20cmdlet%20on%20PowerShell.%20It%20displayes%20the%20information%20you%E2%80%99ll%20need%20from%20the%20available%20ETW%20providers%20on%20that%20machine.)%3C%2FP%3E%0A%3CP%3EYou%20can%20save%20this%20file%20as%20%E2%80%9CLogMonitorConfig.json%E2%80%9D%20on%20the%20same%20folder%20you%E2%80%99ll%20build%20your%20container%20image.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EBuild%20a%20new%20container%20image%20with%20Log%20Monitor%20and%20its%20config%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ENext%2C%20you%E2%80%99ll%20need%20to%20build%20the%20image%20with%20the%20Log%20Monitor%20tool.%20Here%E2%80%99s%20a%20sample%20docker%20file%20to%20build%20an%20image%20based%20on%20the%20IIS%20base%20container%20image%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3EFROM%20mcr.microsoft.com%2Fwindows%2Fservercore%2Fiis%3Awindowsservercore-ltsc2022%0AWORKDIR%20%2FLogMonitor%0ACOPY%20LogMonitorConfig.json%20.%0ARUN%20powershell.exe%20-command%20wget%20-uri%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fwindows-container-tools%2Freleases%2Fdownload%2Fv1.1%2FLogMonitor.exe%20-outfile%20LogMonitor.exe%0A%23%20Change%20the%20startup%20type%20of%20the%20IIS%20service%20from%20Automatic%20to%20Manual%0ARUN%20sc%20config%20w3svc%20start%3Ddemand%0A%23%20Enable%20ETW%20logging%20for%20Default%20Web%20Site%20on%20IIS%0ARUN%20c%3A%5Cwindows%5Csystem32%5Cinetsrv%5Cappcmd.exe%20set%20config%20-section%3Asystem.applicationHost%2Fsites%20%2F%22%5Bname%3D'Default%20Web%20Site'%5D.logFile.logTargetW3C%3A%22File%2CETW%22%22%20%2Fcommit%3Aapphost%0AEXPOSE%2080%0A%23%20Start%20%22C%3A%5CLogMonitor%5CLogMonitor.exe%20C%3A%5CServiceMonitor.exe%20w3svc%22%0AENTRYPOINT%20%5B%22C%3A%5C%5CLogMonitor%5C%5CLogMonitor.exe%22%2C%20%22C%3A%5C%5CServiceMonitor.exe%22%2C%20%22w3svc%22%5D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20docker%20file%20above%20uses%20the%20LTSC%202022%20base%20container%20image%20with%20IIS%20installed%2C%20copy%20the%20json%20file%20we%20just%20built%2C%20downloads%20the%20Log%20Monitor%20tool%20from%20GitHub%20(you%20can%20download%20it%20separately%20if%20you%20prefer)%2C%20then%20configures%20IIS%20so%20the%20Log%20Monitor%20tool%20would%20be%20able%20to%20get%20the%20ETW%20providers%20its%20preconfigured%20to%2C%20and%20finally%20it%20configures%20the%20Log%20Monitor%20tool%20as%20the%20entry%20point%20for%20the%20container.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20the%20docker%20file%20above%20also%20on%20the%20same%20location%20of%20your%20json%20file%20and%20the%20app%20you%20want%20to%20try%20out%20(in%20case%20you%20have%20one)%2C%20you%20can%20run%20the%20below%20command%20to%20build%20an%20image%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Edocker%20build%20-t%20testapp%3Av1%20.%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENext%2C%20we%20can%20run%20the%20container%20to%20try%20out%20the%20web%20page%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Edocker%20run%20-d%20-p%208080%3A80%20--name%20testcontainer%20testapp%3Av1%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20command%20above%20will%20start%20a%20container%20that%20will%20have%20its%20port%2080%20mapped%20to%20the%20port%208080%20on%20the%20container%20host.%20Now%2C%20open%20a%20web%20browser%20and%20try%20to%20access%20%3CA%20href%3D%22http%3A%2F%2Flocalhost%3A8080%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Flocalhost%3A8080%3C%2FA%3E.%20If%20you%20did%20not%20deploy%20a%20different%20application%2C%20this%20will%20open%20the%20IIS%20splash%20screen%20from%20inside%20the%20container.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EUse%20Docker%20Logs%20to%20retrieve%20the%20logs%20from%20the%20container%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ENow%20we%20can%20use%20the%20docker%20logs%20command%20to%20see%20what%E2%80%99s%20happening%20inside%20the%20container%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Edocker%20logs%20testcontainer%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20output%20of%20the%20command%20above%20might%20be%20short%20or%20very%20long%20depending%20on%20how%20many%20events%20you%20filtered%20or%20chose%20to%20show%20or%20not.%20Here%E2%80%99s%20what%20I%20got%20from%20my%20test%20environment%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LogMonitorTool01.png%22%20style%3D%22width%3A%20952px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350500iC23FF3C8DE5CB2FD%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22LogMonitorTool01.png%22%20alt%3D%22LogMonitorTool01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOn%20the%20above%2C%20I%E2%80%99m%20highlighting%20that%20the%20logs%20shown%20in%20the%20output%20provide%20the%20details%20on%20the%20visitor%20(myself)%20to%20the%20website%20we%E2%80%99re%20monitoring.%20The%20same%20way%2C%20the%20logs%20would%20have%20shown%20other%20errors%20related%20to%20my%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EConclusion%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EThe%20Log%20Monitor%20tool%20is%20a%20great%20tool%20to%20get%20Windows%20Event%2C%20log%20files%2C%20and%20ETW%20into%20stdout%2C%20which%20is%20the%20standard%20format%20for%20containers.%20There%20are%20many%20ways%20to%20filter%20the%20source%20of%20your%20logs%20and%20you%20can%20make%20it%20work%20with%20your%20own%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20the%20next%20blogs%20in%20the%20series%2C%20we%E2%80%99ll%20start%20exploring%20ways%20to%20make%20this%20process%20less%20manual%20and%20more%20efficient.%20Let%20me%20know%20what%20you%20think%20of%20this%20series%20so%20far%20in%20the%20comments%20section.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3201318%22%20slang%3D%22en-US%22%3E%3CP%3ELearn%20how%20you%20can%20troubleshoot%20an%20application%20on%20Windows%20Containers%20with%20the%20Log%20Monitor%20tool.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Windows-Containers-Log-Monitor.jpg%22%20style%3D%22width%3A%20787px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F353669iA6E722C2887429A8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Windows-Containers-Log-Monitor.jpg%22%20alt%3D%22Windows-Containers-Log-Monitor.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3201318%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVinicius%20Apolinario%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3250966%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20troubleshoot%20applications%20on%20Windows%20Containers%20with%20the%20Log%20Monitor%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3250966%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Gregory%2C%3C%2FP%3E%0A%3CP%3EI%20just%20tested%20it%20and%20it%20actually%20works.%20Take%20a%20look%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LogMonitorTool02.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F354049iA0C0A67730397903%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22LogMonitorTool02.png%22%20alt%3D%22LogMonitorTool02.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOn%20the%20image%20above%2C%20you%20can%20see%20I%20did%20not%20set%20up%20a%20json%20config%20file%2C%20but%20instead%20I%20put%20LogMonitor%20to%20monitor%20the%20execution%20of%20a%20ping%20to%20localhost%2C%20since%20the%20goal%20was%20to%20just%20check%20if%20it%20worked.%20And%20it%20does.%20It%20brings%20back%20the%20output%20of%20the%20command%20it%20is%20monitoring.%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EVinicius.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3250706%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20troubleshoot%20applications%20on%20Windows%20Containers%20with%20the%20Log%20Monitor%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3250706%22%20slang%3D%22en-US%22%3E%3CP%3EDoes%20LogMonitor%20support%20nanoserver%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Version history
Last update:
‎Mar 08 2022 09:17 AM
Updated by: