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