locked
Getting the contents of a table stored in Azure Storage RRS feed

  • Question

  • I have a Web Role hosted on Azure that transfers the Azure logs to a hosted storage account every hour.  I have tried to use a third-party tool, Azure Storage Explorer, to confirm that the contents of the hosted storage account was actually getting updated with the log info.  However, this third-party tool is not very useful as it constantly has errors when retrieving a large number of entries.

    So, I was looking for the easiest way to access the contents of the table stored on the hosted storage account.

    I have found sample code to query a table with

    IEnumerable<Contact> entities = TableHelper.QueryEntities<Contact>("sampletable").Where(e => e.PartitionKey == "USA").AsTableServiceQuery<Contact>();

    but this sample code uses Contact generics, and I am not sure what generic to use when I am using the default WADLogsTable where it has columns of PartitionKey, RowKey, Timestamp,  EventTickCount, DeploymentId, Role, RoleInstance, Level, EventId, Pid, Tid, Message.

     

    Overall, I am not very satisfied with the usability of the hosted storage account, unless I am missing an easy way to access the contents of the table logs?

     

    Any help would be appreciated.

     

    Thanks.

    Thanks.

    Friday, April 1, 2011 4:47 PM

Answers

All replies

  • Hi,

    If you're looking for a tool to view diagnostics data, may I suggest you take a look at our product Azure Diagnostics Manager (http://www.cerebrata.com/Products/AzureDiagnosticsManager). This tool is designed specifically to view diagnostics data captured by Windows Azure Diagnostics.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

    Friday, April 1, 2011 5:43 PM
  • Hello,

    I understand you use Azure Storage Explorer to browse diagnostics data and it has error when retrieving hug number of entries.

    As I know, while using Azure Storage Explorer to query table storage, we can write filter to return data we want and we can also specify the max rows to return. Have you tried these functionalities?

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Monday, April 4, 2011 3:35 AM
  • I have seen these functionalities, but I have not been able to use them successfully. 

     

    For example, I do not know how to filter by log date successfully.  In the Query field, I have tried Timestamp='2/16/2011' but I get an error message in a red box at the bottom of the screen stating "An error occurred while processing this request."

    Monday, April 4, 2011 12:48 PM
  • Hi,

    For diagnostics data, the PartitionKey is generated using the higher order bits of DateTime.Ticks (in UTC). I would recommend using that for your querying instead of querying by Timestamp attribute (because this will result in full table scan).

    Here is what you will do:

    1. For your "from date time", find out the Ticks (in UTC) and then prepend a zero in front of it.

    2. Do the same thing for "to date time".

    3. Construct your query like PartitionKey ge '<from date/time ticks (step 1)>' and PartitionKey le '<to date/time ticks (step 2)>'

    I've written a blog post on writing queries against Table storage, which you may find useful when querying against Table storage: http://www.cerebrata.com/Blog/post/Specifying-24filter-criteria-when-querying-Azure-Table-Storage-using-REST-API.aspx.

    Hope this helps.

    Thanks

    Gaurav

    • Proposed as answer by Jai Haridas Tuesday, April 5, 2011 1:52 PM
    Monday, April 4, 2011 1:48 PM
  • Hi,

    The datetime value must be combined UTC format and with "datetime" as prefix. So to filter result by Timestamp, the filter might be:

    Timestamp ge datetime'2011-02-16T00:00:00Z' and Timestamp le datetime'2011-02-17T00:00:00Z'

    Please see Formatting DateTime Property Values and Querying Tables and Entities.

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Tuesday, April 5, 2011 1:54 AM
  • I would like to reiterate what Gaurav has proposed since the above solution does a table scan and is not efficient in terms of performance and cost when your log tables span multiple large partitions. Please filter by Partitionkey (and if possible RowKey) as that leads to fewer continuation tokens as the table grows. 

    Thanks,

    jai

    Tuesday, April 5, 2011 1:52 PM