How to collect IIS logs in a container


Description

The article describes how to collect IIS logs of a process that is run inside a container.

Solution

To collect IIS logs, proceed as follows:

  1. Run a PowerShell session within the container, see How to run PowerShell in container
    > docker container exec -it <container-name/id> powershell
  2. Navigate to IIS logs folder and copy log files to the local machine:
    > cd C:\inetpub\logs\LogFiles\
    > ls # Find the name of IIS logs folder
    > docker cp <local path> <container>:”C:\inetpub\logs\LogFiles\<W3SVC1>\<u_ex221025.log>”