سؤال

it's my first time working with Azure Storage Explorer and I need to read some logs that is save into Azure Tables. The version of mine is 4

I read this reference http://msdn.microsoft.com/library/azure/ff683669.aspx but there is not explanation to work with the column Timestamp.

Basically, I want to see logs since a specific date.

I tried query like;

Timestamp ge '4/10/2013' Timestamp ge 4/10/2013 Timestamp gt '4/10/2013'
Timestamp gt 4/10/2013

And the result is only a error message.

An error occurred while processing this request.

هل كانت مفيدة؟

المحلول

It looks like you would need to use something like below in order to filter on a Timestamp. Please look at Filtering on DateTime Properties here.

Timestamp ge datetime'2008-07-10T00:00:00Z'

نصائح أخرى

Use TableQuery.GenerateFilterConditionForDate() methods to set datetime based query parameters against Azure table storage tables:

using Microsoft.WindowsAzure.Storage.Table;

// Input parameters to your method, etc:
DateTimeOffset from;
DateTimeOffset until;

string DateFromFilter = TableQuery.GenerateFilterConditionForDate("Date", QueryComparisons.GreaterThanOrEqual, from);
string DateUntilFilter = TableQuery.GenerateFilterConditionForDate("Date", QueryComparisons.LessThanOrEqual, until);

finalFilter is just a string which you build up using TableQuery methods such as CombineFilters():

finalFilter = TableQuery.CombineFilters(finalFilter, TableOperators.And, DateFromFilter);
finalFilter = TableQuery.CombineFilters(finalFilter, TableOperators.And, DateUntilFilter);

TableQuery<MyAzureObject> query = new TableQuery<MyAzureObject>().Where(finalFilter);

This is how you could do it:

var dateFilter = "(PartitionKey ge '0" + StartTime.Ticks + "')" + "and (PartitionKey le '0" + EndTime.Ticks + "')";

StartTime and EndTime will be your date range. Remember that you can only query over PartitionKey because it has index.

This should work

Timestamp ge datetime'2013-10-06T00:00:00'

If you want to filter the query in the date range use:

Timestamp ge datetime'2017-07-21T20:07:35.000Z' and Timestamp lt datetime'2017-07-24T20:07:35.000Z'

its old but I got this working like this.

Timestamp ge datetime'2020-10-06T00:00:00'
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top