Audit Media Services Control Plane logs

Media Services logo v3


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

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:

  1. Sign into the Azure portal.
  2. Navigate to the Media Services account you want to work with.
  3. Select Diagnostic Settings under Monitor.
  4. Select Add diagnostic setting.
  5. Enter a name in the Diagnostic setting name field.
  6. 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.
  7. Select the Send to Log Analytics workspace checkbox.
  8. The subscription for the Media Services account should already be selected in the Subscription dropdown list.
  9. Select the workspace from the Log Analtyics workspace dropdown list. If there are no workspaces listed, create one.
  10. 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:

  1. Sign into the Azure portal.
  2. 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.