### BytesReceived

This property enables you to retrieve the number of bytes received during the operation from the current log record.

###### Syntax

count = oIISLog.BytesReceived

###### Parameters

count
  The number of bytes received.

###### Example

The following example opens a log file in the default format, and displays the chosen properties for each entry. This is a very large example, but it can be used as a tool to view any property for any entry in a log file.

--- Log_Properties.asp ---

    <HTML>
    <HEAD><TITLE></TITLE></HEAD>
    <BODY>

    <% 'Get all the inputs from the FORM if there are any.
    LogFile = Request.Form("logfile")
    StartDate = Request.Form("startdt")
    EndDate = Request.Form("enddt")
    BytesReceived = Request.Form("BytesReceived")
    BytesSent = Request.Form("BytesSent")
    ClientIP = Request.Form("ClientIP")
    Cookie = Request.Form("Cookie")
    CustomFields = Request.Form("CustomFields")
    DateTime = Request.Form("DateTime")
    Method = Request.Form("Method")
    ProtocolStatus = Request.Form("ProtocolStatus")
    ProtocolVersion = Request.Form("ProtocolVersion")
    Referer = Request.Form("Referer")
    ServerIP = Request.Form("ServerIP")
    ServerName = Request.Form("ServerName")
    ServerPort = Request.Form("ServerPort")
    ServiceName = Request.Form("ServiceName")
    TimeTaken = Request.Form("TimeTaken")
    URIQuery = Request.Form("URIQuery")
    URIStem = Request.Form("URIStem")
    UserAgent = Request.Form("UserAgent")
    UserName = Request.Form("UserName")
    Win32Status = Request.Form("Win32Status")

    ' Let the user select the inputs.
    %>

    <H3>Display a Range of Log Records by Date</H3>

    <FORM NAME="getlogfilename" METHOD="POST" ACTION="Log_Properties.asp">
    Please enter the full path name of a log file to read in %SystemRoot%\system32\LogFiles\*SVC*\*.log:<BR>
    <input type="TEXT" NAME="logfile" size=70 value=<%=LogFile%>><BR><BR>
    Please select the properties you want to show:<BR>
    <TABLE><TR>
    <TD><input type="CHECKBOX" NAME="BytesReceived" value="True" <%If BytesReceived Then Response.Write "CHECKED"%>> BytesReceived </TD>
    <TD><input type="CHECKBOX" NAME="ServerIP" value="True" <%If ServerIP Then Response.Write "CHECKED"%>> ServerIP </TD>
    <TD><input type="CHECKBOX" NAME="DateTime" value="True" <%If DateTime Then Response.Write "CHECKED"%>> DateTime </TD>
    <TD><input type="CHECKBOX" NAME="URIQuery" value="True" <%If URIQuery Then Response.Write "CHECKED"%>> URIQuery </TD>
    </TR><TR>
    <TD><input type="CHECKBOX" NAME="BytesSent" value="True" <%If BytesSent Then Response.Write "CHECKED"%>> BytesSent </TD>
    <TD><input type="CHECKBOX" NAME="ServerName" value="True" <%If ServerName Then Response.Write "CHECKED"%>> ServerName </TD>
    <TD><input type="CHECKBOX" NAME="Method" value="True" <%If Method Then Response.Write "CHECKED"%>> Method </TD>
    <TD><input type="CHECKBOX" NAME="URIStem" value="True" <%If URIStem Then Response.Write "CHECKED"%>> URIStem </TD>
    </TR><TR>
    <TD><input type="CHECKBOX" NAME="ClientIP" value="True" <%If ClientIP Then Response.Write "CHECKED"%>> ClientIP </TD>
    <TD><input type="CHECKBOX" NAME="ServerPort" value="True" <%If ServerPort Then Response.Write "CHECKED"%>> ServerPort </TD>
    <TD><input type="CHECKBOX" NAME="ProtocolStatus" value="True" <%If ProtocolStatus Then Response.Write "CHECKED"%>> ProtocolStatus </TD>
    <TD><input type="CHECKBOX" NAME="UserAgent" value="True" <%If UserAgent Then Response.Write "CHECKED"%>> UserAgent </TD>
    </TR><TR>
    <TD><input type="CHECKBOX" NAME="Cookie" value="True" <%If Cookie Then Response.Write "CHECKED"%>> Cookie </TD>
    <TD><input type="CHECKBOX" NAME="ServiceName" value="True" <%If ServiceName Then Response.Write "CHECKED"%>> ServiceName </TD>
    <TD><input type="CHECKBOX" NAME="ProtocolVersion" value="True" <%If ProtocolVersion Then Response.Write "CHECKED"%>> ProtocolVersion </TD>
    <TD><input type="CHECKBOX" NAME="UserName" value="True" <%If UserName Then Response.Write "CHECKED"%>> UserName </TD>
    </TR><TR>
    <TD><input type="CHECKBOX" NAME="CustomFields" value="True" <%If CustomFields Then Response.Write "CHECKED"%>> CustomFields </TD>
    <TD><input type="CHECKBOX" NAME="TimeTaken" value="True" <%If TimeTaken Then Response.Write "CHECKED"%>> TimeTaken </TD>
    <TD><input type="CHECKBOX" NAME="Referer" value="True" <%If Referer Then Response.Write "CHECKED"%>> Referer </TD>
    <TD><input type="CHECKBOX" NAME="Win32Status" value="True" <%If Win32Status Then Response.Write "CHECKED"%>> Win32Status </TD>
    </TR></TABLE><BR>
    Start DateTime:
    <input type="TEXT" NAME="startdt" value=<%=StartDate%>> (Optional)<BR>
    End DateTime:
    <input type="TEXT" NAME="enddt" value=<%=EndDate%>> (Optional)<BR>
    (Use the format 'MM/DD/YYYY HH:MM:SS AM/PM')<BR><BR>
    <INPUT TYPE="SUBMIT" VALUE="Submit">
    </FORM>

    <%
    ''''''''''''''''''''
    '  Log file formats:
    '  "NCSA Common Log File Format"
    '  "Microsoft IIS Log File Format"
    '  "W3C Extended Log File Format"
    '''''''''''''''''''''

    Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")

    If (fsoObject.FileExists(LogFile)) Then

      Set oRead = CreateObject ("MSWC.IISLog")
      oRead.OpenLogFile LogFile, 1, "W3SVC", 1, 0

      If Not (StartDate = "" Or EndDate = "") Then
        oRead.ReadFilter StartDate,EndDate
      End If

      oRead.ReadLogRecord
    %>
    <TABLE Border=1>
    <TR>
    <%
      If DateTime Then Response.Write "<TD><B>DateTime</TD>"
      If BytesReceived Then Response.Write "<TD><B>BytesReceived</TD>"
      If BytesSent Then Response.Write "<TD><B>BytesSent</TD>"
      If ClientIP Then Response.Write "<TD><B>ClientIP</TD>"
      If Cookie Then Response.Write "<TD><B>Cookie</TD>"
      If CustomFields Then Response.Write "<TD><B>CustomFields</TD>"
      If Method Then Response.Write "<TD><B>Method</TD>"
      If ProtocolStatus Then Response.Write "<TD><B>ProtocolStatus</TD>"
      If ProtocolVersion Then Response.Write "<TD><B>ProtocolVersion</TD>"
      If Referer Then Response.Write "<TD><B>Referer</TD>"
      If ServerIP Then Response.Write "<TD><B>ServerIP</TD>"
      If ServerName Then Response.Write "<TD><B>ServerName</TD>"
      If ServerPort Then Response.Write "<TD><B>ServerPort</TD>"
      If ServiceName Then Response.Write "<TD><B>ServiceName</TD>"
      If TimeTaken Then Response.Write "<TD><B>TimeTaken</TD>"
      If URIQuery Then Response.Write "<TD><B>URIQuery</TD>"
      If URIStem Then Response.Write "<TD><B>URIStem</TD>"
      If UserAgent Then Response.Write "<TD><B>UserAgent</TD>"
      If UserName Then Response.Write "<TD><B>UserName</TD>"
      If Win32Status Then Response.Write "<TD><B>Win32Status</TD>"
    %>
    </TR>
    <%
      Do While Not oRead.AtEndOfLog

        Response.Write "<TR>"
        If DateTime Then Response.Write "<TD>&nbsp;" & oRead.DateTime & "</TD>"
        If BytesReceived Then Response.Write "<TD>&nbsp;" & oRead.BytesReceived & "</TD>"
        If BytesSent Then Response.Write "<TD>&nbsp;" & oRead.BytesSent & "</TD>"
        If ClientIP Then Response.Write "<TD>&nbsp;" & oRead.ClientIP & "</TD>"
        If Cookie Then Response.Write "<TD>&nbsp;" & oRead.Cookie & "</TD>"
        If CustomFields Then
          Response.Write "<TD>&nbsp;"
          For i = 1 To UBound(oRead.CustomFields)
            Response.Write oRead.CustomFields(i,1) & " = " & oRead.CustomFields(i,2) & "<BR>"
          Next
          Response.Write "</TD>"
        End If
        If Method Then Response.Write "<TD>&nbsp;" & oRead.Method & "</TD>"
        If ProtocolStatus Then Response.Write "<TD>&nbsp;" & oRead.ProtocolStatus & "</TD>"
        If ProtocolVersion Then Response.Write "<TD>&nbsp;" & oRead.ProtocolVersion & "</TD>"
        If Referer Then Response.Write "<TD>&nbsp;" & oRead.Referer & "</TD>"
        If ServerIP Then Response.Write "<TD>&nbsp;" & oRead.ServerIP & "</TD>"
        If ServerName Then Response.Write "<TD>&nbsp;" & oRead.ServerName & "</TD>"
        If ServerPort Then Response.Write "<TD>&nbsp;" & oRead.ServerPort & "</TD>"
        If ServiceName Then Response.Write "<TD>&nbsp;" & oRead.ServiceName & "</TD>"
        If TimeTaken Then Response.Write "<TD>&nbsp;" & oRead.TimeTaken & "</TD>"
        If URIQuery Then Response.Write "<TD>&nbsp;" & oRead.URIQuery & "</TD>"
        If URIStem Then Response.Write "<TD>&nbsp;" & oRead.URIStem & "</TD>"
        If UserAgent Then Response.Write "<TD>&nbsp;" & oRead.UserAgent & "</TD>"
        If UserName Then Response.Write "<TD>&nbsp;" & oRead.UserName & "</TD>"
        If Win32Status Then Response.Write "<TD>&nbsp;" & oRead.Win32Status & "</TD>"
        Response.Write "</TR>"
        oRead.ReadLogRecord

      Loop
    %>
    </TR></TABLE>
    <%
      oRead.CloseLogFiles 1

    ElseIf Not (LogFile = "") Then

      Response.Write "ERROR: " & LogFile & " does not exist."

    End If

    %>

    </BODY>
    </HTML>

© 1997-2001 Microsoft Corporation. All rights reserved.