http://blogs.msdn.com/b/windowsazurestorage/archive/2011/08/03/windows-azure-storage-logging-using-logs-to-track-storage-requests.aspx
http://blogs.msdn.com/b/windowsazurestorage/archive/2011/08/03/windows-azure-storage-metrics-using-metrics-to-track-storage-usage.aspx
Turning Logging On
A REST API call, as shown below, is used to turn on Logging. In this example, logging is turned on for deletes and writes, but not for reads. The retention policy is enabled and set to ten days - so the analytics service will take care of deleting data older than ten days for you at no additional cost. Note that you need to turn on logging separately for blobs, tables, and queues. The example below demonstrates how to turn logging on for blobs.
Request: PUT http://sally.blob.core.windows.net/?restype=service&comp=properties HTTP/1.1 x-ms-version: 2009-09-19 x-ms-date: Fri, 25 Mar 2011 23:13:08 GMT Authorization: SharedKey sally:zvfPm5cm8CiVP2VA9oJGYpHAPKxQb1HD44IWmubot0A= Host: sally.blob.core.windows.net <?xml version="1.0" encoding="utf-8"?> <StorageServiceProperties> <Logging> <Version>1.0</Version> <Delete>true </Delete> <Read> false</Read> <Write>true </Write> <RetentionPolicy> <Enabled>true</Enabled> <Days>7</Days> </RetentionPolicy> </Logging> <Metrics> <Version>1.0</Version> <Enabled>true</Enabled> <IncludeAPIs>true</IncludeAPIs> <RetentionPolicy> <Enabled>true</Enabled> <Days>10</Days> </RetentionPolicy> </Metrics> </StorageServiceProperties > Response: HTTP/1.1 202 Content-Length: 0 Server: Windows-Azure-Metrics/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-id: 4d02712a-a68a-4763-8f9b-c2526625be68 x-ms-version: 2009-09-19 Date: Fri, 25 Mar 2011 23:13:08 GMT
The above logging and metrics section shows you how to configure what you want to track in your analytics logs and metrics data. The logging configuration values are described below:
- Version - The version of Analytics Logging used to record the entry.
- Delete (Boolean) – set to true if you want to track delete requests and false if you do not
- Read (Boolean) – set to true if you want to track read requests and false if you do not
- Write (Boolean) – set to true if you want to track write requests and false if you do not
- Retention policy – this is where you set the retention policy to help you manage the size of your analytics data
- Enabled (Boolean) – set to true if you want to enable a retention policy. We recommend that you do this.
- Days (int) – the number of days you want to keep your analytics logging data. This can be a max of 365 days and a min of 1 day.
Turning Metrics On
A REST API call, as shown below, is used to turn Analytics on for Metrics. In this example, logging is turned on for deletes and writes, but not for reads. The retention policy is enabled and set to ten days - so the analytics service will take care of deleting data older than ten days for you at no additional cost.
Request: PUT http://sally.blob.core.windows.net/?restype=service&comp=properties HTTP/1.1 x-ms-version: 2009-09-19 x-ms-date: Fri, 25 Mar 2011 23:13:08 GMT Authorization: SharedKey sally:zvfPm5cm8CiVP2VA9oJGYpHAPKxQb1HD44IWmubot0A= Host: sally.blob.core.windows.net <?xml version="1.0" encoding="utf-8"?> <StorageServiceProperties> <Logging> <Version>1.0</Version> <Delete>true </Delete> <Read> false</Read> <Write>true </Write> <RetentionPolicy> <Enabled>true</Enabled> <Days>7</Days> </RetentionPolicy> </Logging> <Metrics> <Version>1.0</Version> <Enabled>true</Enabled> <IncludeAPIs>true</IncludeAPIs> <RetentionPolicy> <Enabled>true</Enabled> <Days>10</Days> </RetentionPolicy> </Metrics> </StorageServiceProperties > Response: HTTP/1.1 202 Content-Length: 0 Server: Windows-Azure-Metrics/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-id: 4d02712a-a68a-4763-8f9b-c2526625be68 x-ms-version: 2009-09-19 Date: Fri, 25 Mar 2011 23:13:08 GMT
The logging and metrics sections allow you to configure what you want to track in your analytics logs and metrics data. The metrics configuration values are described here:
- Version - The version of Analytics Logging used to record the entry.
- Enabled (Boolean) – set to true if you want track metrics data via analytics
- IncludedAPIs (Boolean) – set to true if you want to track metrics for the individual APIs accessed
- Retention policy – this is where you set the retention policy to help you manage the size of your analytics data
- Enabled (Boolean) – set to true if you want to enable a retention policy. We recommend that you do this.
- Days (int) – the number of days you want to keep your analytics logging data. This can be a max of 365 days and a min of 1 day