Comments (3)
The non-privileged user can be given access to ETW logs by adding the user to the "Performance Log Users" group. To deal with the Failed to stop or query status of service 'w3svc'
error, set permissions on the w3svc
service.
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022
SHELL [ "powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'; " ]
# Add ContainerUser to Performance Log Users group to allow LogMonitor to access ETW logs
RUN Add-LocalGroupMember -Group 'Performance Log Users' -Member 'User Manager\ContainerUser'`
# Allow ContainerUser to start/stop/restart/read status of the IIS Windows Service
# (S-1-5-93-2-2 is user "User Manager\ContainerUser" in this container image)
RUN cmd.exe /C "sc.exe sdset w3svc 'D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA) (A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RPWPDTLO;;;S-1-5-93-2-2)'"
Some of this information was originally sourced from the following links:
- https://stackoverflow.com/a/67502244/144713
- https://blogs.msmvps.com/erikr/2007/09/26/set-permissions-on-a-specific-service-windows/
from windows-container-tools.
Sample of the Dockerfile used when receiving this.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
#copy over our custom DLLs
COPY dlls/* ./dlls/
# copy csproj and restore as distinct layers
COPY OES_WebApp/*.csproj ./OES_WebApp/
COPY OES_WebApp/*.config ./OES_WebApp/
RUN nuget restore
# copy everything else and build app
COPY OES_WebApp/. ./OES_WebApp/
#RUN msbuild /p:Configuration=Release,RestorePackagesConfig=true -r:False -t:restore,build
RUN msbuild -t:build -p:RestorePackagesConfig=true
# Use a smaller image as base for runtime
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8 AS runtime
# Set the shell to PowerShell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; Set-ExecutionPolicy Unrestricted -Force;"]
# Disable IIS auto start
RUN ["cmd", "/S", "/C", "sc", "config", "w3svc", "start=demand"]
# Update IIS config
# c:/windows/system32/inetsrv/appcmd.exe set config -section:system.applicationHost/sites /[name='Default Web Site'].logFile.logTargetW3C:File,ETW /commit:apphost ;
# c:/windows/system32/inetsrv/appcmd.exe set config -section:system.applicationHost/sites /\"[name='Default Web Site'].logFile.logTargetW3C:\"File,ETW\"\" /commit:apphost ;
RUN \
# Enable ETW logging for Default Web Site on IIS
c:/windows/system32/inetsrv/appcmd.exe set config -section:system.applicationHost/sites /\"[name='Default Web Site'].logFile.logTargetW3C:\"File,ETW\"\" /commit:apphost ;
# swap to unprivilaged - unable to use with Logmon? Errors when using ContainerUser
# USER ContainerUser
# Add Logmon to the image to export various sources to STDOUT - see LogMonConfig for details
COPY logmon/LogMonitor.exe logmon/LogMonitorConfig.json c:/LogMonitor/
# Pull in our built application from the 'build' base
WORKDIR /inetpub/wwwroot
COPY --from=build /app/OES_WebApp/. ./
# Start IIS Remote Management and monitor IIS
ENTRYPOINT ["C:\\LogMonitor\\LogMonitor.exe", "C:\\ServiceMonitor.exe", "w3svc"]
# TODO - need to start IIS after config and wrapping with logmon
EXPOSE 80
from windows-container-tools.
We are having the same issue on AKS. The image is failing to start at the entry point with the below error.
INFO: Entrypoint processs exit code: 0
[LOGMONITOR] ERROR: Failed to wait for log file monitor to stop
Etrypoint we have in docker file:
ENTRYPOINT ["C:\\LogMonitor\\LogMonitor.exe", "dotnet.exe", "Application.dll"]
Below are the AKS details
v1.27.1 Windows Server 2019 Datacenter 10.0.17763.4974 containerd://1.6.21+azure
Any update on this issue?
from windows-container-tools.
Related Issues (20)
- Failed to format ETW event property. Unexpected length of 0 for intype 300 and outtype 0 HOT 6
- [BUG] If level is omitted, the tool does not display all events in the named channel, spanning various levels HOT 8
- [BUG] process monitor does not support multi-byte characters
- Getting ERROR: Error in log file monitor. Failed to query file information [BUG] HOT 5
- [BUG] LogMonitor requires Path to folder to exist before it is started for file logging.
- [BUG] 30 second delay HOT 2
- [BUG] Debug Assertion Failed! for debug build
- [BUG] LogMonitor.exe version reads 2.0.0.LM_BUILDMINORVERSION instead of 2.0.0 HOT 1
- [BUG] [LOGMONITOR] ERROR: Failed to enable event channel system: 0x6BA HOT 16
- [BUG] [LOGMONITOR] WARNING: Failed to render event log event. The event will not be processed. Error: 15033. HOT 3
- What is timeline for release 2.0.1 or 2.1 ? HOT 3
- Format Warning/Error Messages
- [BUG] ][LOGMONITOR] ERROR: Failed to query next event. Error: 21. HOT 13
- Tool List - coming soon HOT 1
- Filter file logs HOT 1
- STDOUT propagation is broken after termination signal
- [BUG] Missing first lines with File Monitor and non-existing log directory HOT 1
- [BUG] Process monitor adds XML when format is custom
- [Discussion] Certificate Tool HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windows-container-tools.