Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

How do I bulk change IIS Logging fields?

We are running IIS 6 and have noticed that the date and time are not being logged.

We can go into each site manually and in advanced logging properties tick the "date" and "time" property. Restarting the site fixes the problem.

Our problem is that we have several thousand sites.

Is there a way to apply this change to all sites on a server?

We have already tried changing the parameters in the root and restarting WWW Publishing, however that did not have an effect.
0
turnto11
Asked:
turnto11
1 Solution
 
Brad HoweCommented:
Hi,

You use ADSUTIL to achieve this. Each Extended Log option has a specific value assigned.

For example:

LogExtFileDate             = 1
LogExtFileTime             = 2
LogExtFileClientIp             = 4
LogExtFileUserName       = 8
LogExtFileSiteName       = 16
LogExtFileComputerName       = 32
LogExtFileServerIp             = 64
LogExtFileMethod              = 128
LogExtFileUriStem             = 256
LogExtFileUriQuery             = 512
LogExtFileHttpStatus       = 1024
LogExtFileWin32Status       = 2048
LogExtFileBytesSent       = 4096
LogExtFileBytesRecv       = 8192
LogExtFileTimeTaken       = 16384
LogExtFileCookie             = 131072
LogExtFileReferer             = 262144
LogExtFileServerPort       = 32768
LogExtFileProtocolVersion       = 524288
LogExtFileUserAgent       = 65536
LogExtFileHttpSubStatus       = 2097152
LogExtFileHost              = 1048576

For example;

To Assign All Sites in IIS to have ALL Advanced Logging options selected [x], you would execute the following.
    cd c:\inetpub\AdminScripts\
    adsutil.vbs SET W3SVC/LogExtFileFlags "4194303"

NOTE the lack of WEBSITE IDENTIFIER between W3SVC and the Option.

To Assign it to just (1) SITE you execute it with the WEBSITE IDENTIFIER included.
    cd c:\inetpub\AdminScripts\
    adsutil.vbs SET W3SVC/<WEB-SITE-ID>/LogExtFileFlags "4194303"

So to get the proper settings you need, start with "4194303" - Equals ALL Settings checked - and begin substract the the values from above you don't want checked. The remain is the addition of the value that are [x].

Any value that you do not subtract from "4194303" is set to [x].

msdn reference has the detail value for each flag:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/4f4de2c6-7151-4a01-ac2d-3545869c7625.asp

Cheers,
Hades666
0
 
turnto11Author Commented:
That did it. Thanks!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now