Example #1
0
 private void PopulateVersion1Log(LogRecordStreamReader reader)
 {
     this.RequestStartTime = reader.ReadDateTimeOffset("o");
     this.OperationType = reader.ReadString();
     this.RequestStatus = reader.ReadString();
     this.HttpStatusCode = reader.ReadString();
     this.EndToEndLatency = reader.ReadTimeSpanInMS();
     this.ServerLatency = reader.ReadTimeSpanInMS();
     this.AuthenticationType = reader.ReadString();
     this.RequesterAccountName = reader.ReadString();
     this.OwnerAccountName = reader.ReadString();
     this.ServiceType = reader.ReadString();
     this.RequestUrl = reader.ReadUri();
     this.RequestedObjectKey = reader.ReadQuotedString();
     this.RequestIdHeader = reader.ReadGuid();
     this.OperationCount = reader.ReadInt();
     this.RequesterIPAddress = reader.ReadString();
     this.RequestVersionHeader = reader.ReadString();
     this.RequestHeaderSize = reader.ReadLong();
     this.RequestPacketSize = reader.ReadLong();
     this.ResponseHeaderSize = reader.ReadLong();
     this.ResponsePacketSize = reader.ReadLong();
     this.RequestContentLength = reader.ReadLong();
     this.RequestMD5 = reader.ReadQuotedString();
     this.ServerMD5 = reader.ReadQuotedString();
     this.ETagIdentifier = reader.ReadQuotedString();
     this.LastModifiedTime = reader.ReadDateTimeOffset("dddd, dd-MMM-yy HH:mm:ss 'GMT'");
     this.ConditionsUsed = reader.ReadQuotedString();
     this.UserAgentHeader = reader.ReadQuotedString();
     this.ReferrerHeader = reader.ReadQuotedString();
     this.ClientRequestId = reader.ReadQuotedString();
     reader.EndCurrentRecord();
 }
Example #2
0
 private void PopulateVersion1Log(LogRecordStreamReader reader)
 {
     this.RequestStartTime     = reader.ReadDateTimeOffset("o");
     this.OperationType        = reader.ReadString();
     this.RequestStatus        = reader.ReadString();
     this.HttpStatusCode       = reader.ReadString();
     this.EndToEndLatency      = reader.ReadTimeSpanInMS();
     this.ServerLatency        = reader.ReadTimeSpanInMS();
     this.AuthenticationType   = reader.ReadString();
     this.RequesterAccountName = reader.ReadString();
     this.OwnerAccountName     = reader.ReadString();
     this.ServiceType          = reader.ReadString();
     this.RequestUrl           = reader.ReadUri();
     this.RequestedObjectKey   = reader.ReadQuotedString();
     this.RequestIdHeader      = reader.ReadGuid();
     this.OperationCount       = reader.ReadInt();
     this.RequesterIPAddress   = reader.ReadString();
     this.RequestVersionHeader = reader.ReadString();
     this.RequestHeaderSize    = reader.ReadLong();
     this.RequestPacketSize    = reader.ReadLong();
     this.ResponseHeaderSize   = reader.ReadLong();
     this.ResponsePacketSize   = reader.ReadLong();
     this.RequestContentLength = reader.ReadLong();
     this.RequestMD5           = reader.ReadQuotedString();
     this.ServerMD5            = reader.ReadQuotedString();
     this.ETagIdentifier       = reader.ReadQuotedString();
     this.LastModifiedTime     = reader.ReadDateTimeOffset("dddd, dd-MMM-yy HH:mm:ss 'GMT'");
     this.ConditionsUsed       = reader.ReadQuotedString();
     this.UserAgentHeader      = reader.ReadQuotedString();
     this.ReferrerHeader       = reader.ReadQuotedString();
     this.ClientRequestId      = reader.ReadQuotedString();
     reader.EndCurrentRecord();
 }
        /// <summary>
        /// Returns an enumerable collection of Analytics log records, retrieved lazily.
        /// </summary>
        /// <param name="stream">The <see cref="System.IO.Stream"/> object from which to parse log records.</param>
        /// <returns>An enumerable collection of objects that implement <see cref="LogRecord"/> and are retrieved lazily.</returns>
        public static IEnumerable <LogRecord> ParseLogStream(Stream stream)
        {
            LogRecordStreamReader reader = new LogRecordStreamReader(stream, (int)stream.Length);
            LogRecord             log;

            while (!reader.IsEndOfFile)
            {
                log = new LogRecord(reader);
                yield return(log);
            }
        }
 /// <summary>
 /// Returns an enumerable collection of Analytics log records, retrieved lazily.
 /// </summary>
 /// <param name="logBlob">The <see cref="ICloudBlob"/> object from which to parse log records.</param>
 /// <returns>An enumerable collection of objects that implement <see cref="LogRecord"/> and are retrieved lazily.</returns>
 public static IEnumerable <LogRecord> ParseLogBlob(ICloudBlob logBlob)
 {
     using (Stream stream = ((CloudBlockBlob)logBlob).OpenRead())
     {
         using (LogRecordStreamReader reader = new LogRecordStreamReader(stream, (int)stream.Length))
         {
             LogRecord log;
             while (!reader.IsEndOfFile)
             {
                 log = new LogRecord(reader);
                 yield return(log);
             }
         }
     }
 }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LogRecord"/> class based on a <see cref="LogRecordStreamReader"/> object.
        /// <param name="reader">The <see cref="LogRecordStreamReader"/> object to use to populate the log record.</param>
        /// </summary>
        internal LogRecord(LogRecordStreamReader reader)
        {
            CommonUtility.AssertNotNull("reader", reader);

            this.VersionNumber = reader.ReadString();
            CommonUtility.AssertNotNullOrEmpty("VersionNumber", this.VersionNumber);

            if (string.Equals("1.0", this.VersionNumber, StringComparison.Ordinal))
            {
                this.PopulateVersion1Log(reader);
            }
            else
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, SR.LogVersionUnsupported, this.VersionNumber));
            }
        }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LogRecord"/> class based on a <see cref="LogRecordStreamReader"/> object.
        /// <param name="reader">The <see cref="LogRecordStreamReader"/> object to use to populate the log record.</param>
        /// </summary>
        internal LogRecord(LogRecordStreamReader reader)
        {
            CommonUtility.AssertNotNull("reader", reader);

            this.VersionNumber = reader.ReadString();
            CommonUtility.AssertNotNullOrEmpty("VersionNumber", this.VersionNumber);

            if (string.Equals("1.0", this.VersionNumber, StringComparison.Ordinal))
            {
                this.PopulateVersion1Log(reader);
            }
            else
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, SR.LogVersionUnsupported, this.VersionNumber));
            }
        }
 /// <summary>
 /// Returns an enumerable collection of Analytics log records, retrieved lazily.
 /// </summary>
 /// <param name="stream">The <see cref="System.IO.Stream"/> object from which to parse log records.</param>
 /// <returns>An enumerable collection of objects that implement <see cref="LogRecord"/> and are retrieved lazily.</returns>
 public static IEnumerable<LogRecord> ParseLogStream(Stream stream)
 {
     LogRecordStreamReader reader = new LogRecordStreamReader(stream, (int)stream.Length);
     LogRecord log;
     while (!reader.IsEndOfFile)
     {
         log = new LogRecord(reader);
         yield return log;
     }
 }
 /// <summary>
 /// Returns an enumerable collection of Analytics log records, retrieved lazily.
 /// </summary>
 /// <param name="logBlob">The <see cref="ICloudBlob"/> object from which to parse log records.</param>
 /// <returns>An enumerable collection of objects that implement <see cref="LogRecord"/> and are retrieved lazily.</returns>
 public static IEnumerable<LogRecord> ParseLogBlob(ICloudBlob logBlob)
 {
     using (Stream stream = ((CloudBlockBlob)logBlob).OpenRead())
     {
         using (LogRecordStreamReader reader = new LogRecordStreamReader(stream, (int)stream.Length))
         {
             LogRecord log;
             while (!reader.IsEndOfFile)
             {
                 log = new LogRecord(reader);
                 yield return log;
             }
         }
     }
 }