With Azure diagnostic logs, you can view core analytics and save them into one or more destinations including:
- Azure Storage account
- Log Analytics workspace
- Azure Event Hubs
This feature is available on cdn endpoints for all pricing tiers.
Diagnostics logs allow you to export basic usage metrics from your CDN endpoint to different kinds sources so that you can consume them in a customized way. You can do the following types of data export:
- Export data to blob storage, export to CSV, and generate graphs in Excel.
- Export data to Event Hubs and correlate with data from other Azure services.
- Export data to Azure Monitor logs and view data in your own Log Analytics workspace
Enable logging with the Azure portal
Follow these steps enable logging for your Azure CDN endpoint:
To use a storage account to store the logs, follow these steps:
To use Log Analytics for the logs, follow these steps:
To use an event hub for the logs, follow these steps:
Enable logging with PowerShell
The following example shows how to enable diagnostic logs via the Azure PowerShell Cmdlets.
Consuming diagnostics logs from Azure Storage
This section describes the schema of CDN core analytics, organization in an Azure storage account, and provides sample code to download the logs in a CSV file.
To download the tool, see Azure Storage Explorer. After downloading and installing the software, configure it to use the same Azure storage account that was configured as a destination to the CDN Diagnostics Logs.
Core analytics logs are generated every hour and the data is collected and stored inside a single Azure blob as a JSON payload. Storage explorer tool interprets ‘/’ as a directory separator and shows the hierarchy. The path to the Azure blob appears as if there’s a hierarchical structure and represents the blob name. The name of the blob follows the following naming convention:
resourceId=/SUBSCRIPTIONS/{Subscription Id}/RESOURCEGROUPS/{Resource Group Name}/PROVIDERS/MICROSOFT.CDN/PROFILES/{Profile Name}/ENDPOINTS/{Endpoint Name}/ y=/m=/d=/h=/m=/PT1H.json
Description of fields:
To access core analytics, sample code for a tool is provided. This tool allows downloading the JSON files into a flat comma-separated file format, which can be used to create charts or other aggregations.
Here’s how you can use the tool:
Log data delays
The following table shows log data delays for Azure CDN Standard from Microsoft, Azure CDN Standard from Akamai, and Azure CDN Standard/Premium from Verizon.
Diagnostic log types for CDN core analytics
Microsoft currently offers core analytics logs only, which contain metrics showing HTTP response statistics and egress statistics as seen from the CDN POPs/edges.
The following table shows a list of metrics available in the core analytics logs for:
- Azure CDN Standard from Microsoft
- Azure CDN Standard from Akamai
- Azure CDN Standard/Premium from Verizon
Not all metrics are available from all providers, although such differences are minimal. The table also displays whether a given metric is available from a provider. The metrics are available for only those CDN endpoints that have traffic on them.
*Outbound data transfer refers to traffic delivered from CDN POP servers to the client.
All logs are stored in JSON format and each entry has string fields according to the following schema:
"records": [ { "time": "2017-04-27T01:00:00", "resourceId": "<ARM Resource Id of the CDN Endpoint>", "operationName": "Microsoft.Cdn/profiles/endpoints/contentDelivery", "category": "CoreAnalytics", "properties": { "DomainName": "<Name of the domain for which the statistics is reported>", "RequestCountTotal": integer value, "RequestCountHttpStatus2xx": integer value, "RequestCountHttpStatus3xx": integer value, "RequestCountHttpStatus4xx": integer value, "RequestCountHttpStatus5xx": integer value, "RequestCountHttpStatusOthers": integer value, "RequestCountHttpStatus200": integer value, "RequestCountHttpStatus206": integer value, "RequestCountHttpStatus302": integer value, "RequestCountHttpStatus304": integer value, "RequestCountHttpStatus404": integer value, "RequestCountCacheHit": integer value, "RequestCountCacheMiss": integer value, "RequestCountCacheNoCache": integer value, "RequestCountCacheUncacheable": integer value, "RequestCountCacheOthers": integer value, "EgressTotal": double value, "EgressHttpStatus2xx": double value, "EgressHttpStatus3xx": double value, "EgressHttpStatus4xx": double value, "EgressHttpStatus5xx": double value, "EgressHttpStatusOthers": double value, "EgressCacheHit": double value, "EgressCacheMiss": double value, "EgressCacheNoCache": double value, "EgressCacheUncacheable": double value, "EgressCacheOthers": double value, } } ] }
Where time represents the start time of the hour boundary for which the statistics is reported. A metric unsupported by a CDN provider, instead of a double or integer value, results in a null value. This null value indicates the absence of a metric, and is different from a value of 0. One set of these metrics per domain is configured on the endpoint.
Example properties:
{ "DomainName": "manlingakamaitest2.azureedge.net", "RequestCountTotal": 480, "RequestCountHttpStatus2xx": 480, "RequestCountHttpStatus3xx": 0, "RequestCountHttpStatus4xx": 0, "RequestCountHttpStatus5xx": 0, "RequestCountHttpStatusOthers": 0, "RequestCountHttpStatus200": 480, "RequestCountHttpStatus206": 0, "RequestCountHttpStatus302": 0, "RequestCountHttpStatus304": 0, "RequestCountHttpStatus404": 0, "RequestCountCacheHit": null, "RequestCountCacheMiss": null, "RequestCountCacheNoCache": null, "RequestCountCacheUncacheable": null, "RequestCountCacheOthers": null, "EgressTotal": 0.09, "EgressHttpStatus2xx": null, "EgressHttpStatus3xx": null, "EgressHttpStatus4xx": null, "EgressHttpStatus5xx": null, "EgressHttpStatusOthers": null, "EgressCacheHit": null, "EgressCacheMiss": null, "EgressCacheNoCache": null, "EgressCacheUncacheable": null, "EgressCacheOthers": null }
Additional resources
原文链接:https://docs.microsoft.com/en-us/azure/cdn/cdn-azure-diagnostic-logs
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/217