Kuzey
Kuzey

Reputation: 869

Custom IIS access logging on Azure

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.

Upvotes: 1

Views: 251

Answers (2)

spuder
spuder

Reputation: 18457

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

Upvotes: 0

BilalAlam
BilalAlam

Reputation: 1227

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.

Upvotes: 2

Related Questions