// Populate the List<> with blob logs for the given prefix. // http://blogs.msdn.com/b/windowsazurestorage/archive/2011/08/03/windows-azure-storage-logging-using-logs-to-track-storage-requests.aspx private static async Task GetLogsWithPrefixAsync(List <IStorageBlob> selectedLogs, IStorageBlobClient blobClient, string prefix, CancellationToken cancellationToken) { // List the blobs using the prefix IEnumerable <IStorageListBlobItem> blobs = await blobClient.ListBlobsAsync(prefix, useFlatBlobListing : true, blobListingDetails : BlobListingDetails.Metadata, cancellationToken : cancellationToken); // iterate through each blob and figure the start and end times in the metadata // Type cast to IStorageBlob is safe due to useFlatBlobListing: true above. foreach (IStorageBlob item in blobs) { IStorageBlob log = item as IStorageBlob; if (log != null) { // we will exclude the file if the file does not have log entries in the interested time range. string logType = log.Metadata[LogType]; bool hasWrites = logType.Contains("write"); if (hasWrites) { selectedLogs.Add(log); } } } }