在Azure表存储中存储应用程序日志的策略 [英] Strategy for storing application logs in Azure Table Storage
问题描述
我要确定一种在Azure Table Storage中存储日志记录信息的好策略.我有以下内容:
I am to determine a good strategy for storing logging information in Azure Table Storage. I have the following:
PartitionKey:日志的名称.
RowKey :倒置的DateTime滴答声,
RowKey: Inversed DateTime ticks,
这里唯一的问题是分区可能会变得非常大(数以百万计的实体),并且分区的大小会随着时间而增加.
The only issue here is that partitions could get very large (millions of entities) and the size will increase with time.
但是,要说的是,正在执行的查询类型将始终包括PartitionKey
(不扫描)和RowKey
过滤器(次要扫描).
But that being said, the type of queries being performed will always include the PartitionKey
(no scanning) AND a RowKey
filter (a minor scan).
例如(使用自然语言):
For example (in a natural language):
where `PartitionKey` = "MyApiLogs" and
where `RowKey` is between "01-01-15 12:00" and "01-01-15 13:00"
假设查询是在PartitionKey
和RowKey
上完成的,我知道分区的大小无关紧要.
Provided that the query is done on both PartitionKey
and RowKey
, I understand that the size of the partition doesn't matter.
推荐答案
Take a look at our new Table Design Patterns Guide - specifically the log-data anti-pattern as it talks about this scenario and alternatives. Often when people write log files they use a date for the PK which results in a partition being hot as all writes go to a single partition. Quite often Blobs end up being a better destination for log data - as people typically end up processing the logs in batches anyway - the guide talks about this as an option.
这篇关于在Azure表存储中存储应用程序日志的策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!