문제

I would like to exclude user IP field in IIS access logs for a ASP.NET service hosted on Azure. Is there a way to achieve this? I'm using WAD to collect logs into a blob storage.

도움이 되었습니까?

해결책

You will want to run an elevated Azure role startup task (see http://blogs.msdn.com/b/avkashchauhan/archive/2011/03/17/using-startup-task-in-windows-azure-detailed-summary.aspx) and run the following command to remove ClientIP field from logs:

%windir%\system32\inetsrv\appcmd set config -section:sites -siteDefaults.logfile.logExtFileFlags:Date,Time,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,ServerPort,UserAgent,HttpSubStatus,Referer

In the above command line "ClientIp" is removed which should remove the user IP field from the logs.

다른 팁

To add to BilalAlam's answer (though this doesn't directly answer the question)

His example will change logging for all sites

appcmd set config -section:sites -siteDefaults.logfile.logExtFileFlags:Date,Time,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,ServerPort,UserAgent,HttpSubStatus,Referer

Here is how to change logging for a single site

appcmd.exe set config -section:sites -"[name='ExampleSite'].logfile.logExtFileFlags:Date,Time,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,BytesSent,BytesRecv,ServerPort,UserAgent,Cookie,HttpSubStatus,Referer"����

If you want to make the change at the application host config file (instead of the web.config file), add /commit:apphost to the end of the command

appcmd.exe set config -section:sites -"[name='ExampleSite'].logfile.logExtFileFlags:Date,Time,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,BytesSent,BytesRecv,ServerPort,UserAgent,Cookie,HttpSubStatus,Referer" /commit:apphost
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top