microsoft / IIS.ServiceMonitor

An entrypoint process for running IIS in Windows containers
MIT License
126 stars 42 forks source link

Add Stdout logging #1

Closed shirhatti closed 4 years ago

shirhatti commented 6 years ago

Based on feedback from @artisticcheese in https://github.com/Microsoft/iis-docker/issues/44, we should consider writing w3c logs to stdout.

artisticcheese commented 6 years ago

I would suggest instead use ETW events and consume them instead of tailing physical file log for multiple reasons.

shirhatti commented 6 years ago

Agreed. I'm leaning to use ETW as well and we will verify this hypothesis before implementation.

shirhatti commented 6 years ago

Re-opening this issue per feedback in https://github.com/Microsoft/IIS.ServiceMonitor/pull/20#issuecomment-399576040

bariscaglar commented 6 years ago

The plan is to have a reusable module that listens on the IIS ETW events and writes to an output stream. The design will be similar to that of w3logsvc.

tekmaven commented 6 years ago

The previous attempt printed IIS log file data. I do agree this should be written to stdout, but I think there is a greater need here for overall control of stdout from an IIS worker process inside the container. As an example, we are using NLog extensively in a .NET Framework ASP.NET application and would like to add our own application log data to the output of the container as well.

bearkat2173 commented 5 years ago

ASP.Net logs app crashes to the Application event log. Don't we need some type of facility to port ETW messages from container to host?

gerich-home commented 5 years ago

Any plans on implementing this feature?

benc-uk commented 5 years ago

Any update? Running IIS via this image in Kubernetes and not being able to to do kubectl logs is a huge headache. How do people use this image without logs?

Rod-Sychev commented 4 years ago

I can't believe this issue still hasn't been resolved!

anarsen commented 4 years ago

Any update? Running IIS via this image in Kubernetes and not being able to to do kubectl logs is a huge headache. How do people use this image without logs?

You could have a sidecar which tails the IIS access logs to stdout. It's far from ideal - I know.

geoffreygeslin commented 4 years ago

Seems like this new "LogMonitor" tool can be configured to listen these IIS logs or events : https://github.com/microsoft/windows-container-tools/tree/master/LogMonitor

I do not have myself a Dockerized Windows IIS based application, but if anyone try it, it would be gread to share the LogMonitor instruction configured in his DockerFile to monitor IIS.

jhkimnew commented 4 years ago

We have implemented an experimental tag at https://github.com/microsoft/iis-docker/blob/master/windowsservercore-insider/Dockerfile which uses the logmonitor to fix this issue. If using logmonitor become commont for most users, we are going to integrate the tool to the existing or new official IIS tags. See https://blogs.iis.net/jeonghwan/how-to-use-iis-insider-docker-tag for the detail.

oliver-dungey commented 4 years ago

@jhkimnew Love it, this is exactly what we've been looking for. I can now see ETW events in my containers console. Looking at https://github.com/microsoft/windows-container-tools/blob/master/LogMonitor/src/LogMonitor/sample-config-files/IIS/LogMonitorConfig.json I can see how to configure more file/ETW log sources but there isn't much in the way of documentation - could do with some more examples.

The big question though is can I configure the STDOUT of my web application to appear in the console? I really don't want the container to waste time writing to log files and then thunking them to STDOUT with LogMonitor - I just want the STDOUT stream of the web app redirected to the container output. Any input much appreciated.