Advanced Logging for IIS 7.0 - Client Logging

IIS Advanced Logging can accept information about client-consumption of media and other content. Clients (for example, Microsoft Silverlight) can send useful data about their interaction with media content. This information forms the basis of analytic reporting, which can help businesses improve their content placement and their Return on Investment (ROI).

IIS Advanced Logging accepts client logs by using standard HTTP POST messages and XML formatting, enabling most clients to use this capability

In this article:

Requirements

For client logging to be useful, a client must send messages to IIS Advanced Logging via HTTP POST in the expected XML format. Clients that can do this include:

  • The IIS Smooth Streaming sample client.
  • Applications based on Microsoft Silverlight 3. Silverlight 3 includes new metrics that you can use to post messages in the required XML format to the Web server with IIS Advanced Logging installed.

Enabling Client Logging

Client logging in IIS Advanced Logging is disabled by default. To enable this feature, do the following:

  1. In IIS Manager, on the Home page for the server where you would like to receive client logs, double-click the Advanced Logging icon.

  2. In the Actions pane, click Enable Client Logging.

Using the Smooth Streaming Sample Client

IIS Smooth Streaming is an adaptive streaming platform from Microsoft that enables bit-rate switching to accommodate a client's changing resource conditions (network throughput and CPU). For IIS Advanced Logging, we can use the Smooth Streaming sample client, which provides rich data collection capabilities. This section describes how to set up the Smooth Streaming sample client and configure IIS Advanced Logging to log the client-side analytical data.

Setting up the sample client

To set up the Smooth Streaming sample client, do the following:

  1. Click here to download the IIS Smooth Streaming sample content, which includes the sample client.
  2. When you are prompted to extract the sample, click Yes.
  3. When you are prompted to accept the License Agreement terms, click Yes.
  4. When you are asked to specify a location where you want to place the extracted files, enter a directory path (for example, C:\LoggingSampleClient). If prompted to create the directory, click Yes (this prompt will appear only if the directory does not exist).

When you navigate to the directory that you extracted the sample content to, you will see a file named SampleClient.xap. This is the sample logging client. See the Smooth Streaming documentation to see how you can use this client or simply replace the .xap file in existing content with this file (rename if necessary or update the html that refers it).

Configuring the Smooth Steaming Sample Client

The only configuration possible with the Smooth Streaming sample client is to set the log URL, which determines where the client will send HTTP POST messages containing the collected statistics. This section discusses two configuration options for logging Smooth Streaming client statistics.

Client-side manifest

Clients read the LogUrl element in a client-side manifest to determine the URL where the HTTP POST should be sent. Multiple LogUrl elements mean that the HTTP POST is sent to all the URLs in the list. The URLs specified in the Initialization parameters section of this article are added to the list obtained from the manifest.

The syntax for adding LogUrls to the manifest is as follows:

<SmoothStreamingMedia
  MajorVersion="1"
  MinorVersion="0"
  Duration="6537916781">
<LogUrl>http://logserver/iislogging.log</LogUrl>
<StreamIndex
    Type="video"
    Subtype="WVC1"
    Chunks="327"
    Url="QualityLevels({bitrate})/Fragments(video={start time})">

Initialization parameters

The Log URL can also be set using the PARAM tag initparams while instantiating the client. The syntax is as follows (you can specify multiple LogUrls via a semi-colon separated list):

Note   The values for the LogUrls in the initparams must be complete HTTP URLs. Use of relative URLs is not permitted.

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
    <param name="source" value="SampleClient.xap"/>
    <param name="onerror" value="onSilverlightError" />
    <param name="initparams" value='autoplay=true,autoload=true,enablecaptions=true,muted=false,displaytimecode=true,playlist=<playList><playListItems><playListItem title="test" description="test" mediaSource="http://server/contentdir/content.ism/manifest" adaptiveStreaming="True" thumbSource="" frameRate="24.0" width="512" height="384" ></playListItem></playListItems></playList>,logUrls=http://server/contentdir/post.log' />                                      
    <a href="http://go2.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
    <img src="http://go2.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
    </a>
</object>

Configuring the Log Definition

For IIS Advanced Logging to take advantage of client logging capabilities, related fields and the log definition must be configured in the configuration store. While it's possible to use the Advanced Logging user interface in IIS Manager to do this, an easier way to configure the log definition is to use the script AddClientConfig.js. Click here to download the script in a compressed (zipped) folder (ClientConfig_2.zip).

The script syntax is as follows:

AddClientConfig.js [/f:<fields.xml>] [/b:<baseFileName>]

where fields.xml is the XML file included in the zipped folder and baseFileName is the name you want to give your log definition. If you don't specify a baseFileName, IIS Advanced Logging will use the default log definition name: %COMPUTERNAME%-Client.

After running the above script, restart the Web server by using the IIS Reset command-line utility or by restarting the Web server in IIS Manager:

  1. In the Connections pane, click the Web server name.
  2. In the Actions pane, click Restart.

The Web Server running IIS Advanced Logging can now receive client-side logs.

Smooth Streaming Sample Client - Log Events

The sample client will post log messages for each of the following events:

  • Play. Indicates the start of a play request. IIS Advanced Logging will begin calculating statistics.
  • Seek. The client jumps to a new location. This event does not invalidate the current session or create a new one. All statistics other than the following continue to be cumulative:
    • c-starttime. The client resets to a new location using the Seek function. This field as specified above suggests the time in the video where playback started.
    • startupTime. Seeking may may cause the client buffer to be filled again, so we reset this value.
    • x-duration. The duration is reset to 0 when c-starttime changes.
  • Stop. Client progressive download and playback stopped. However, the session (c-playerid GUID) is not invalidated. Restarting playback will start from 0 offset again and at that point all the following fields will continue to be cumulative:
    • c-starttime. Resets to 0.
    • startupTime. Calculated again.
    • x-duration. Resets to 0.
  • Pause. This is similar to Stop, except that playback (when resumed) continues from the location where it was paused. In this case, all fields except the following continue to be cumulative:
    • startupTime. Calculated again
  • Periodic. A snapshot of log data that is posted at 30-second intervals. The 30-second interval is calculated from a previous periodic log or from another log created from any of the other events above. You should not misinterpret that this event occurs every 30 seconds. When another event occurs and a log is sent, the next periodic log is sent after 30 seconds has elapsed. This ensures that you don’t log two events in a 30-second window unless two events occur during that interval.

Smooth Streaming Sample Client – Log Fields

IIS Advanced Logging can record client data for the following logging fields.

Field

Details

date

The date the log was generated.

time

The time the log was generated.

cs-url

The manifest URL for the content item.

c-playerId

A unique GUID generated for each Smooth Streaming content, or a playlist if the content is part of one.

c-buffercount

Number of times rebuffering is required. This is how many times we underflow basically. This is calculated at the frame level.

c-playerVersion

Silverlight version

c-bytes

Number of bytes received by the client from the server. The value does not include any overhead that is added by the network stack. However, HTTP may introduce some overhead. Therefore, the same content streamed by using different protocols may result in different values. If c-bytes and sc-bytes(server-side) are not identical, packet loss occurred.

audiocodec

Audio codec

videocodec

Video codec

c-starttime

The point where the client began watching the stream (in seconds, no fraction). For true live streaming, we need to calculate time offset using wallclock time.

x-duration

Duration (in seconds) of the data rendered by the client from c-starttime.

c-os

Operating system of the client computer.

c-osversion

Operating system version of the client computer.

startupTimeMs

From play to render first frame (in milliseconds).

c-playerState

Play/stop/pause, and so on.

bandwidthMax

Maximum perceived bandwidth

bandwidthMin

Minimum perceived bandwidth

bandwidthAvg

Average perceived bandwidth

droppedFramesPerSecond

Dropped frames per second (provided by Silverlight)

renderedFramesPerSecond

Rendered frames per second (provided by Silverlight)

hasDRM

The value can be true, false, or an enum such as DRM, PlayReady, Lightweight, and so on.

audioResponseTimeAvg

Average response time to get audio chunks. This is time from request to last byte.

audioResponseTimeMax

Maximum response time to get audio chunks. This is time from request to last byte.

audioResponseTimeMin

Minimum response time to get audio chunks. This is time from request to last byte.

videoResponseTimeAvg

Average response time to get video chunks. This is time from request to last byte.

videoResponseTimeMax

Maximum response time to get video chunks. This is time from request to last byte.

videoResponseTimeMin

Minimum response time to get video chunks. This is time from request to last byte.

smoothStreamingVersion

Smooth Streaming client version

audioDownloadErrors

Total number of missing audio chunks (for example, 404s). This is a semicolon-separated list of starttime/chunk IDs.

videoDownloadErrors

Total number of missing video chunks (for example, 404s). This is a semicolon-separated list of starttime/chunk IDs

audioPlaybackBitrates

An ordered list of the audio bit-rates played during playback. This is a semicolon-separated list. This list is in the order of playback. There may be duplicate entries.

videoPlaybackBitrates

An ordered list of the video bit-rates played during playback. This is a semicolon-separated list. This list is in the order of playback. There may be duplicate entries.

audioPlaybackBitrateDurations

An ordered list of durations of each of the audio bit rates played during playback. This is a semicolon-separated list. This list is in the order of playback. There may be duplicate entries.

videoPlaybackBitrateDurations

An ordered list of durations of each of the video bit rates played during playback in order. This is a semicolon-separated list. This list is in the order of playback. There may be duplicate entries.

audioBandwidthAvg

Average audio bit rate for the downloaded chunks

videoBandwidthAvg

Average video bit rate for the downloaded chunks

audioBufferSizeAvg

Average audio buffer size (in seconds) during playback

audioBufferSizeMax

Maximum audio buffer size (in seconds) during playback

videoBufferSizeAvg

Average video buffer size (in seconds) during playback

videoBufferSizeMax

Maximum video buffer size (in seconds) during playback

audioSwitches

Number of audio bit-rate switches

videoSwitches

Number of video bit-rate switches

 

Smooth Streaming Sample Client - Sample Log Message

The following is a sample log from the Smooth Streaming sample client:

<?xml version="1.0" encoding="utf-8"?>
<XML>
  <applicationUri>http://www.contoso.com/AdaptiveStreamingStatsTracker.xap</applicationUri>
  <audioBandwidthAvg>932844</audioBandwidthAvg>
  <audioBandwidthMax>27343198</audioBandwidthMax>
  <audioBandwidthMin>46528</audioBandwidthMin>
  <audioBitrates>160016</audioBitrates>
  <audioBufferChunks>0</audioBufferChunks>
  <audioBufferChunksAvg>10</audioBufferChunksAvg>
  <audioBufferChunksMax>11</audioBufferChunksMax>
  <audioBufferSize>0</audioBufferSize>
  <audioBufferSizeAvg>401160</audioBufferSizeAvg>
  <audioBufferSizeMax>458553</audioBufferSizeMax>
  <audioBufferTime>0</audioBufferTime>
  <audioBufferTimeAvg>199669058</audioBufferTimeAvg>
  <audioBufferTimeMax>221692517</audioBufferTimeMax>
  <audioChunks>250</audioChunks>
  <audioCodec>Wma</audioCodec>
  <audioDownloadedDuration>4986427210</audioDownloadedDuration>
  <audioDownloadedSize>10058537</audioDownloadedSize>
  <audioDownloadErrors>0</audioDownloadErrors>
  <audioPlaybackBitrateDurations>4353451247</audioPlaybackBitrateDurations>
  <audioPlaybackBitrates>160016</audioPlaybackBitrates>
  <audioResponseTimeAvg>42</audioResponseTimeAvg>
  <audioResponseTimeMax>881</audioResponseTimeMax>
  <audioResponseTimeMin>1</audioResponseTimeMin>
  <audioSwitches>0</audioSwitches>
  <bandwidthAvg>4721028</bandwidthAvg>
  <bandwidthMax>104207158</bandwidthMax>
  <bandwidthMin>46528</bandwidthMin>
  <browserName>Microsoft Internet Explorer</browserName>
  <browserPlatform>Win32</browserPlatform>
  <browserVersion>4.0</browserVersion>
  <c-buffercount>5</c-buffercount>
  <c-bytes>177010217</c-bytes>
  <clientStartTime>2009-03-19 21:48:18Z</clientStartTime>
  <c-os>Win32NT</c-os>
  <c-osversion>6.0.6001.65536</c-osversion>
  <c-playerId>0a786fb9-ea8b-4851-aa2f-63e2192401ed</c-playerId>
  <c-playerState>EndOfStream</c-playerState>
  <c-playerVersion>2.0.40115.0</c-playerVersion>
  <c-starttime>793</c-starttime>
  <cs-url>http://www.contoso.com/smooth/Big_Buck_Bunny.ism/manifest</cs-url>
  <date>2009-03-19</date>
  <displayHeight>831</displayHeight>
  <displayIsFullScreen>False</displayIsFullScreen>
  <displayWidth>1676</displayWidth>
  <droppedFramesPerSec>0</droppedFramesPerSec>
  <hasDRM>False</hasDRM>
  <isLive>False</isLive>
  <logReason>playerStateChange: Playing-EndOfStream</logReason>
  <manifestRequests>1</manifestRequests>
  <playbackEndTime>2009-03-19 21:59:40Z</playbackEndTime>
  <playbackStartTime>2009-03-19 21:48:19Z</playbackStartTime>
  <renderedFramesPerSec>24</renderedFramesPerSec>
  <requestHeadersEnabled>False</requestHeadersEnabled>
  <seeks>2</seeks>
  <smoothStreamingVersion>2.0</smoothStreamingVersion>
  <startupTimeMs>125.5251</startupTimeMs>
  <time>21:59:40</time>
  <videoBandwidthAvg>6250217</videoBandwidthAvg>
  <videoBandwidthMax>104207158</videoBandwidthMax>
  <videoBandwidthMin>549495</videoBandwidthMin>
  <videoBitrates>336000;636000;936000;1436000;1936000;2936000</videoBitrates>
  <videoBufferChunks>2</videoBufferChunks>
  <videoBufferChunksAvg>10</videoBufferChunksAvg>
  <videoBufferChunksMax>11</videoBufferChunksMax>
  <videoBufferSize>264564</videoBufferSize>
  <videoBufferSizeAvg>6560685</videoBufferSizeAvg>
  <videoBufferSizeMax>8300593</videoBufferSizeMax>
  <videoBufferTime>10833334</videoBufferTime>
  <videoBufferTimeAvg>203326340</videoBufferTimeAvg>
  <videoBufferTimeMax>219583333</videoBufferTimeMax>
  <videoChunks>262</videoChunks>
  <videoCodec>WVC1</videoCodec>
  <videoDownloadedDuration>5223750001</videoDownloadedDuration>
  <videoDownloadedSize>166951680</videoDownloadedSize>
  <videoDownloadErrors>0</videoDownloadErrors>
  <videoPlaybackBitrateDurations>20000000;20000000;20000000;20000000;420000000;760000000;
93333334;20000000;20000000;20000000;20000000;1840000000;669583334;20000000;207916667;20000000;
93333334</videoPlaybackBitrateDurations>
  <videoPlaybackBitrates>336000;636000;936000;1436000;2936000;1936000;2936000;336000;
636000;936000;1436000;2936000;1936000;336000;2936000;336000;2936000</videoPlaybackBitrates>
  <videoResponseTimeAvg>101</videoResponseTimeAvg>
  <videoResponseTimeMax>636</videoResponseTimeMax>
  <videoResponseTimeMin>6</videoResponseTimeMin>
  <videoSwitches>16</videoSwitches>
  <x-duration>11</x-duration>
</XML>

Summary

In this walkthrough, we reviewed the IIS Advanced Logging feature and learned how to log client data. Client logging and real-time logging can make real-time analysis of log files possible.

You also experienced how you can collect meaningful information from the IIS Smooth Streaming experience by using the Smooth Streaming sample client.

References

Related Content

Comments

It's now possible to log POST-data (the data in the request body)?

Mar 20 2009 by awolff

Yes, the POST body will contain the data. I will update the walkthrough with that information. The syntax is as in the sample message above. Let us continue this discussion at http://forums.iis.net/p/1156170/1897532.aspx#1897532

Mar 20 2009 by vsood

I'm curious how the LogUrl>http://servername/iislogging.log/LogUrl> XML element works.

Is the log file declared after the content path arbitrary, or do you need to specifically name the log file something in order to get it to work properly? Using the default iislogging.log file works fine, but I'm curious as to why we need to declare a log file name in the first place?

Apr 01 2009 by three_sixteen

You don't, as long as the request is .log it works fine. It has to do with how handlers work in IIS. Additionally, if you use URL Rewrite, you can make it look like anything

Apr 15 2009 by vsood

"on the Home page for the server, site, or other level where you would like to receive client logs, double-click the Advanced Logging icon"
I dont see this Icon! so my question is,
How do I install the new advanced logging features ?

what am i'm missing ?

Sep 22 2009 by 1973a

Submit a Comment

You must Log In to comment.

Microsoft Communities