Audit Media Services Control Plane logs
Warning
Azure Media Services will be retired June 30th, 2024. For more information, see the AMS Retirement Guide.
Azure Monitor enables you to monitor metrics that help you understand how your applications are performing.
This article shows you how to audit Media Services control plane logs with Log Analytics Worskpaces.
Prerequisites
- Create a Media Services account.
- Review Monitor Media Services.
- Create a Log Analytics Workspace
Enable diagnostic logs for control plane operations
You can enable diagnostic logs for control plane operations by using the Azure portal. After enabling, the diagnostic logs will record the operation as a pair of start and complete events with relevant details.
Use the following steps to enable logging on control plane operations:
- Sign into the Azure portal.
- Navigate to the Media Services account you want to work with.
- Select Diagnostic Settings under Monitor.
- Select Add diagnostic setting.
- Enter a name in the Diagnostic setting name field.
- Select the Audit and/or AllLogs checkbox. Alternatively, you can select the type of log you want. For example, you can check Key Delivery Requests or Media Account Health Status.
- Select the Send to Log Analytics workspace checkbox.
- The subscription for the Media Services account should already be selected in the Subscription dropdown list.
- Select the workspace from the Log Analtyics workspace dropdown list. If there are no workspaces listed, create one.
- Select Save.
View the control plane operations
After you turn on logging, you can use Kusto to query the logs using the Azure Monitor Workspace. The following is a basic example of querying the logs:
- Sign into the Azure portal.
- Select Monitor and then select the Logs pane. It opens a UI where you can easily run queries with that specific account in scope. Run the following query to view control plane logs:
// Media account health events
// Media Services account health details.
AMSMediaAccountHealth
| project EventCode, EventMessage, _ResourceId
| limit 100
//Key delivery failed requests
// AMSKeyDeliveryRequests
// Lists the details of failed key delivery requests
AMSKeyDeliveryRequests
| where ResultType != "Succeeded"
| project KeyId, PolicyName, ResultSignature, StatusMessage, _ResourceId
| limit 100
For more information about working with Log Analytics Workspaces, see Log Analytics workspace overview.