IIS7 – post #26 – Logging in Vista options

I'm following a thread in the newsgroups, actually I replied a few times about setting Logging options at a global level.  Unlike previous versions of client OS's, Vista allows more than 1 site.  One thing that I couldn't find was the Logging options in Vista IIS manager.  I can set this with appcmd and manually set in applicationHost.config.   There are 2 sections I could find, <system.applicationHostlog> section and under <sites/site/siteDefault>  Here are some raw notes I had.  I tried to clean up as best as possible.  One of my favorite appcmd command is "appcmd set config -section:XXXX -?   (XXXX represents what section)"  This pipes out a list of properties for that section.  It was a good evening digging into logging and Vista!   Hope you find this useful.

Example 1
C:WindowsSystem32inetsrv>appcmd list config -section:log
<system.applicationHost>
  <log>
    <centralBinaryLogFile enabled="true" directory="%SystemDrive%inetpublogsLogFiles" />
    <centralW3CLogFile enabled="true" directory="%SystemDrive%inetpublogsLogFiles" />
  </log>
</system.applicationHost>

Example #2
C:WindowsSystem32inetsrv>appcmd set config -section:log -?
ERROR ( message:-logInUTF8
-centralLogFileMode
-centralBinaryLogFile.enabled
-centralBinaryLogFile.directory
-centralBinaryLogFile.period
-centralBinaryLogFile.truncateSize
-centralBinaryLogFile.localTimeRollover
-centralW3CLogFile.enabled
-centralW3CLogFile.directory
-centralW3CLogFile.period
-centralW3CLogFile.truncateSize
-centralW3CLogFile.localTimeRollover
-centralW3CLogFile.logExtFileFlags
 )

'Set the log default path
C:WindowsSystem32inetsrv>appcmd set config -section:log /centralW3CLogFile.directory:c:wwwlogs
Applied configuration changes to section "system.applicationHost/log" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

'Set the log default output
C:WindowsSystem32inetsrv>appcmd set config -section:log /logInUTF8:true
Applied configuration changes to section "system.applicationHost/log" for "MACHNE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

C:WindowsSystem32inetsrv>appcmd list config -section:log
<system.applicationHost>
  <log logInUTF8="true">
    <centralBinaryLogFile enabled="true" directory="%SystemDrive%inetpublogsLogFiles" />
    <centralW3CLogFile enabled="true" directory="c:wwwlogs" />
  </log>
</system.applicationHost>

Example #3
C:WindowsSystem32inetsrv>appcmd set config -section:sites -?
ERROR ( message:-siteDefaults.name
-siteDefaults.id
-siteDefaults.serverAutoStart
-siteDefaults.bindings.[protocol='string',bindingInformation='string'].protocol
-siteDefaults.bindings.[protocol='string',bindingInformation='string'].bindingInformation
-siteDefaults.limits.maxBandwidth
-siteDefaults.limits.maxConnections
-siteDefaults.limits.connectionTimeout
-siteDefaults.logFile.logExtFileFlags
-siteDefaults.logFile.customLogPluginClsid
-siteDefaults.logFile.logFormat
-siteDefaults.logFile.directory
-siteDefaults.logFile.period
-siteDefaults.logFile.truncateSize
-siteDefaults.logFile.localTimeRollover
-siteDefaults.logFile.enabled
-siteDefaults.traceFailedRequestsLogging.enabled
-siteDefaults.traceFailedRequestsLogging.directory
-siteDefaults.traceFailedRequestsLogging.maxLogFiles
-applicationDefaults.path
-applicationDefaults.applicationPool
-applicationDefaults.enabledProtocols
-virtualDirectoryDefaults.path
-virtualDirectoryDefaults.physicalPath
-virtualDirectoryDefaults.userName
-virtualDirectoryDefaults.password
-virtualDirectoryDefaults.logonMethod
-virtualDirectoryDefaults.allowSubDirConfig
-[name='string',id='unknown'].name
-[name='string',id='unknown'].id
-[name='string',id='unknown'].serverAutoStart
-[name='string',id='unknown'].bindings.[protocol='string',bindingInformation='string'].protocol
-[name='string',id='unknown'].bindings.[protocol='string',bindingInformation='string'].bindingInformation
-[name='string',id='unknown'].limits.maxBandwidth
-[name='string',id='unknown'].limits.maxConnections
-[name='string',id='unknown'].limits.connectionTimeout
-[name='string',id='unknown'].logFile.logExtFileFlags
-[name='string',id='unknown'].logFile.customLogPluginClsid
-[name='string',id='unknown'].logFile.logFormat
-[name='string',id='unknown'].logFile.directory
-[name='string',id='unknown'].logFile.period
-[name='string',id='unknown'].logFile.truncateSize
-[name='string',id='unknown'].logFile.localTimeRollover
-[name='string',id='unknown'].logFile.enabled
-[name='string',id='unknown'].traceFailedRequestsLogging.enabled
-[name='string',id='unknown'].traceFailedRequestsLogging.directory
-[name='string',id='unknown'].traceFailedRequestsLogging.maxLogFiles
-[name='string',id='unknown'].applicationDefaults.path
-[name='string',id='unknown'].applicationDefaults.applicationPool
-[name='string',id='unknown'].applicationDefaults.enabledProtocols
-[name='string',id='unknown'].virtualDirectoryDefaults.path
-[name='string',id='unknown'].virtualDirectoryDefaults.physicalPath
-[name='string',id='unknown'].virtualDirectoryDefaults.userName
-[name='string',id='unknown'].virtualDirectoryDefaults.password
-[name='string',id='unknown'].virtualDirectoryDefaults.logonMethod
-[name='string',id='unknown'].virtualDirectoryDefaults.allowSubDirConfig
-[name='string',id='unknown'].[path='string'].path
-[name='string',id='unknown'].[path='string'].applicationPool
-[name='string',id='unknown'].[path='string'].enabledProtocols
-[name='string',id='unknown'].[path='string'].virtualDirectoryDefaults.path
-[name='string',id='unknown'].[path='string'].virtualDirectoryDefaults.physicalPath
-[name='string',id='unknown'].[path='string'].virtualDirectoryDefaults.userName
-[name='string',id='unknown'].[path='string'].virtualDirectoryDefaults.password
-[name='string',id='unknown'].[path='string'].virtualDirectoryDefaults.logonMethod
-[name='string',id='unknown'].[path='string'].virtualDirectoryDefaults.allowSubDirConfig
-[name='string',id='unknown'].[path='string'].[path='string'].path
-[name='string',id='unknown'].[path='string'].[path='string'].physicalPath
-[name='string',id='unknown'].[path='string'].[path='string'].userName
-[name='string',id='unknown'].[path='string'].[path='string'].password
-[name='string',id='unknown'].[path='string'].[path='string'].logonMethod
-[name='string',id='unknown'].[path='string'].[path='string'].allowSubDirConfig
 )

'Set the default log path on the siteDefault section
C:WindowsSystem32inetsrv>appcmd set config -section:sites /siteDefaults.logFile.directory:c:wwwlogs
Applied configuration changes to section "system.applicationHost/sites" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

Log schema in the IIS_schema.xml

 <sectionSchema name="system.applicationHost/log">
    <attribute name="logInUTF8" type="bool" defaultValue="true" />
    <attribute name="centralLogFileMode" type="enum" defaultValue="Site" >
      <enum name="Site" value="0"/>
      <enum name="CentralBinary" value="1"/>
      <enum name="CentralW3C" value="2"/>
    </attribute>
    <element name="centralBinaryLogFile">
      <attribute name="enabled" type="bool" defaultValue="false" />
      <attribute name="directory" type="string" defaultValue="%SystemDrive%inetpublogsLogFiles" />
      <attribute name="period" type="enum" defaultValue="Daily">
        <enum name="Hourly" value="4"/>
        <enum name="Daily" value="1"/>
        <enum name="Weekly" value="2"/>
        <enum name="Monthly" value="3"/>
        <enum name="MaxSize" value="0"/>
      </attribute>
      <attribute name="truncateSize" type="int64" defaultValue="20971520" validationType="integerRange" validationParameter="1048576,4294967295" />
      <attribute name="localTimeRollover" type="bool" defaultValue="false"/>
    </element>
    <element name="centralW3CLogFile">
      <attribute name="enabled" type="bool" defaultValue="true" />
      <attribute name="directory" type="string" expanded="true" defaultValue="%SystemDrive%inetpublogsLogFiles" validationType="nonEmptyString" />
      <attribute name="period" type="enum" defaultValue="Daily">
        <enum name="Hourly" value="4"/>
        <enum name="Daily" value="1"/>
        <enum name="Weekly" value="2"/>
        <enum name="Monthly" value="3"/>
        <enum name="MaxSize" value="0"/>
      </attribute>
      <attribute name="truncateSize" type="int64" defaultValue="20971520" validationType="integerRange" validationParameter="1048576,4294967295" />
      <attribute name="localTimeRollover" type="bool" defaultValue="false"/>
      <attribute name="logExtFileFlags" type="flags" defaultValue="Date, Time, ClientIP, UserName, SiteName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, ServerPort, UserAgent, HttpSubStatus">
        <flag name="Date" value="1"/>
        <flag name="Time" value="2"/>
        <flag name="ClientIP" value="4"/>
        <flag name="UserName" value="8"/>
        <flag name="SiteName" value="16"/>
        <flag name="ComputerName" value="32"/>
        <flag name="ServerIP" value="64"/>
        <flag name="Method" value="128"/>
        <flag name="UriStem" value="256"/>
        <flag name="UriQuery" value="512"/>
        <flag name="HttpStatus" value="1024"/>
        <flag name="Win32Status" value="2048"/>
        <flag name="BytesSent" value="4096"/>
        <flag name="BytesRecv" value="8192"/>
        <flag name="TimeTaken" value="16384"/>
        <flag name="ServerPort" value="32768"/>
        <flag name="UserAgent" value="65536"/>
        <flag name="Cookie" value="131072"/>
        <flag name="Referer" value="262144"/>
        <flag name="ProtocolVersion" value="524288"/>
        <flag name="Host" value="1048576"/>
        <flag name="HttpSubStatus" value="2097152"/>
      </attribute>
    </element>
  </sectionSchema>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s