

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 查看 AWS Elemental MediaTailor 日志
<a name="monitoring-through-logs"></a>

MediaTailor 会发出日志，描述频道和播放配置中的各种里程碑和活动。您可以使用这些日志来了解您的工作流程并对服务问题进行故障排除。以下主题描述了日志和日志记录选项。

**Topics**
+ [广告日志](ads-log-format.md)
+ [清单日志](log-types.md)
+ [对日志进行转码](tm-log-format.md)
+ [使用已售日志](vended-logs.md)
+ [将日志写入 CloudWatch 日志](monitoring-cw-logs.md)
+ [控制广告插入会话日志的数量](log-configuration.md)
+ [筛选日志和事件](logs-filter.md)
+ [生成调试日志](debug-log-mode.md)

# AWS Elemental MediaTailor ADS 日志、描述和事件类型
<a name="ads-log-format"></a>

以下各节描述了为描述广告决策服务器 (ADS) 的事件而 MediaTailor 发出的日志。这些是`AdDecisionServerInteractions`日志。

**Topics**
+ [AdDecisionServerInteractions 事件](#log-types-adsinteraction)
+ [ADS 日志描述](#ads-log-description)
+ [广告日志 JSON 架构](#ads-log-json-schema)

## AdDecisionServerInteractions 事件
<a name="log-types-adsinteraction"></a>

在与广告决策服务器 (ADS) MediaTailor 互动期间，会发出以下事件。


| Log | 说明 | 
| --- | --- | 
| AD\$1MARKER\$1FOUND | MediaTailor 在清单中找到了广告标记。 | 
| BEACON\$1FIRED | 已发射跟踪信标来报告广告事件。在服务器端报告模式（默认）下，会 MediaTailor 触发信标。在客户端报告模式下，回放设备会发射信标。 | 
| EMPTY\$1VAST\$1RESPONSE | ADS 返回了一个空的 VAST 响应，其中包含零个广告。 | 
| EMPTY\$1VMAP\$1RESPONSE | ADS 返回了一个空的 VMAP 响应。 | 
| ERROR\$1ADS\$1INVALID\$1RESPONSE | ADS 返回的状态码不是 200。 | 
| ERROR\$1ADS\$1IO | MediaTailor 尝试与 ADS 通信时遇到错误。 | 
| ERROR\$1ADS\$1RESPONSE\$1PARSE | MediaTailor 解析 ADS 响应时遇到错误。 | 
| ERROR\$1ADS\$1RESPONSE\$1UNKNOWN\$1ROOT\$1ELEMENT | ADS 响应包含无效的根元素。 | 
| ERROR\$1ADS\$1TIMEOUT | 向 ADS 发出的 MediaTailor 请求超时。 | 
| ERROR\$1DISALLOWED\$1HOST | 不允许使用 ADS 主机。 | 
| ERROR\$1FIRING\$1BEACON\$1FAILED | MediaTailor 发射追踪信标失败。 | 
| ERROR\$1PERSONALIZATION\$1DISABLED | 此会话中已禁用广告插入。 | 
| ERROR\$1UNKNOWN | MediaTailor 在 ADS 请求期间遇到未知错误。 | 
| ERROR\$1UNKNOWN\$1HOST | ADS 主机未知。 | 
| ERROR\$1VAST\$1INVALID\$1MEDIA\$1FILE | VAST Ad 有一个无效或缺失的MediaFile元素。 | 
| ERROR\$1VAST\$1INVALID\$1VAST\$1AD\$1TAG\$1URI | VAST 响应包含无效内容VASTAdTagURI。 | 
| ERROR\$1VAST\$1MISSING\$1CREATIVES | VAST Ad 包含零个或多个Creatives元素。只需要一个Creatives元素。 | 
| ERROR\$1VAST\$1MISSING\$1IMPRESSION | VAST Ad 包含零个Impression元素。至少需要一个Impression元素。 | 
| ERROR\$1VAST\$1MISSING\$1MEDIAFILES | VAST Ad 包含零个或多个MediaFiles元素。只需要一个MediaFiles元素。 | 
| ERROR\$1VAST\$1MISSING\$1OVERLAYS | MediaTailor 没有收到来自广告服务器的任何非线性广告素材。 | 
| ERROR\$1VAST\$1MULTIPLE\$1LINEAR | VAS Ad T 包含多个Linear元素。 | 
| ERROR\$1VAST\$1MULTIPLE\$1TRACKING\$1EVENTS | VAS Ad T 包含多个TrackingEvents元素。 | 
| ERROR\$1VAST\$1REDIRECT\$1EMPTY\$1RESPONSE | VAST 重定向请求返回的响应为空。 | 
| ERROR\$1VAST\$1REDIRECT\$1FAILED | VAST 重定向请求遇到了错误。 | 
| ERROR\$1VAST\$1REDIRECT\$1MULTIPLE\$1VAST | VAST 重定向请求返回了多个广告。 | 
| FILLED\$1AVAIL | MediaTailor 成功填补了空缺。 | 
| FILLED\$1OVERLAY\$1AVAIL | MediaTailor 成功填充了叠加层。 | 
| INTERSTITIAL\$1VOD\$1FAILURE | 在填写 VOD 播放列表的插页式广告时，ADS 请求或响应遇到了问题。不会插入任何广告。 | 
| INTERSTITIAL\$1VOD\$1SUCCESS | MediaTailor 已成功填充 VOD 播放列表的插页式广告。 | 
| MAKING\$1ADS\$1REQUEST | MediaTailor 正在向 ADS 请求广告。 | 
| MODIFIED\$1TARGET\$1URL | MediaTailor 修改了出站目标 URL。 | 
| NON\$1AD\$1MARKER\$1FOUND | MediaTailor 在清单中发现了一个不可操作的广告标记。 | 
| RAW\$1ADS\$1RESPONSE | MediaTailor 收到了原始的 ADS 响应。 | 
| REDIRECTED\$1VAST\$1RESPONSE | MediaTailor 在关注 VAST 重定向后收到了 VAST 响应。 | 
| VAST\$1REDIRECT | VAST 广告响应包含重定向。 | 
| VAST\$1RESPONSE | MediaTailor 收到了一个巨大的回应。 | 
| VOD\$1TIME\$1BASED\$1AVAIL\$1PLAN\$1SUCCESS | MediaTailor 成功为 VOD 模板创建了基于时间的使用计划。 | 
| VOD\$1TIME\$1BASED\$1AVAIL\$1PLAN\$1VAST\$1RESPONSE\$1FOR\$1OFFSET | MediaTailor 正在为 VOD 模板创建基于时间的使用计划。 MediaTailor 收到了针对时间偏移的 VAST 响应。 | 
| VOD\$1TIME\$1BASED\$1AVAIL\$1PLAN\$1WARNING\$1NO\$1ADVERTISEMENTS | 在为 VOD 模板创建基于时间的可用计划时，ADS 请求或响应遇到了问题。不会插入任何广告。 | 
| WARNING\$1NO\$1ADVERTISEMENTS | MediaTailor 填写空缺时遇到了问题。未插入任何广告。 | 
| WARNING\$1URL\$1VARIABLE\$1SUBSTITUTION\$1FAILED | MediaTailor 无法替换 ADS 网址中的动态变量。检查网址配置。 | 
| WARNING\$1VPAID\$1AD\$1DROPPED | VPAID 广告因缺少名单而被丢弃，或者会话使用服务器端报告。 | 

## ADS 日志描述
<a name="ads-log-description"></a>

此部分描述了 ADS 日志描述的结构和内容。要在 JSON 编辑器中自行探究，请使用 [广告日志 JSON 架构](#ads-log-json-schema) 上的列表。

ADS 日志中的每个事件都包含日志生成的 CloudWatch 标准字段。有关信息，请参阅[使用日志见解分析 CloudWatch 日志数据](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html)。

### ADS 日志属性
<a name="ads-logs-main"></a>

此部分描述了 ADS 日志的属性。


| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| adsRequestUrl | 字符串 | false | 由发出的 ADS 请求的完整网址 MediaTailor。 | 
| avail | [效用](#ads-logs-avail) 类型的对象 | false | 有关 MediaTailor 充斥着广告的优惠的信息。目前，对于FILLED\$1AVAIL事件类型，这是它首次遇到可用性 MediaTailor 时创建的计划。最终填充效用的方式可能与此计划有所不同，具体取决于内容的播放方式。 | 
| awsAccountId | 字符串 | true | 用于会话的 MediaTailor 配置的 AWS 账户 ID。 | 
| customerId | 字符串 | true | AWS 账户 ID 的哈希版本，可用于关联多个日志条目。 | 
| eventDescription | 字符串 | true |  MediaTailor 服务提供的对触发此日志消息的事件的简短描述。默认情况下，这为空。示例：Got VAST response。 | 
| eventTimestamp | 字符串 | true | 事件的日期和时间。 | 
| eventType | 字符串 | true | 已触发此日志消息的事件的代码。示例：VAST\$1RESPONSE。 | 
| originId | 字符串 | true | 配置中的 MediaTailor 配置名称。这与视频内容源不同，它也是配置的一部分。 | 
| prefetchScheduleName | 字符串 | false | 与此广告事件关联的预取时间表的名称。 | 
| requestHeaders | [requestheaders](#ads-logs-requestheaders) 类型的数组 | false | ADS 请求 MediaTailor 中包含的标头。通常，当对 ADS 的请求失败时，日志会包含这些内容以帮助进行问题排查。 | 
| requestId | 字符串 | true |  MediaTailor 请求 ID，可用于关联同一个请求的多个日志条目。 | 
| sessionId | 字符串 | true |  MediaTailor 分配给玩家会话的唯一数字标识符。玩家为会话提出的所有请求都具有相同的会话 ID。示例：e039fd39-09f0-46b2-aca9-9871cc116cde。 | 
| sessionType | 字符串（合法值：[DASH, HLS]） | true | 玩家流类型。 | 
| vastAd | [vastAd](#ads-logs-vastAd) 类型的对象 | false | 有关从 VAST 响应中解析的单个广告的信息。 | 
| vastResponse | [vastResponse](#ads-logs-vastResponse) 类型的对象 | false | 有关从 ADS MediaTailor 收到的 VAST 响应的信息。 | 
| vodCreativeOffsets | [vodCreativeOffsets](#ads-logs-vodCreativeOffsets) 类型的对象 | false | 根据 VMAP 响应，表示清单中的时间偏移 MediaTailor 将插入可用位置的地图。 | 
| vodVastResponseTimeOffset | 数字 | false | VOD 广告插入的 VMAP 特定时间偏差。 | 

### adContent
<a name="ads-logs-adContent"></a>

此部分描述了 ADS 日志 adContent 的属性。


**ADS 日志 adContent 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| adPlaylistUris | [adPlaylistUris](#ads-logs-adPlaylistUris) 类型的对象 | false | 从变体的原始清单到变体的广告清单的映射。对于 DASH，这包含一个条目，因为所有变体都在一个 DASH 清单中表示。 | 

### adPlaylistUris
<a name="ads-logs-adPlaylistUris"></a>

本节介绍了 ADS 日志的属性 adPlaylistUris。


**ADS 日志 adPlaylistUris 属性**  

| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| <any string> | 字符串 | false | 特定变体的广告清单的 URL。 | 

### 效用
<a name="ads-logs-avail"></a>

此部分描述了 ADS 日志效用的属性。


**ADS 日志效用属性**  

| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| availId | 字符串 | true | 此效用的唯一标识符。对于 HLS，这是效用在其中开始的媒体序列号。对于 DASH，这是周期 ID。 | 
| creativeAds | [creativeAd](#ads-logs-creativeAd) 类型的数组 | true |  MediaTailor 插入广告的广告。 | 
| fillRate | 数字 | true | 广告填充效用持续时间（从 0.0（对于 0%）到 1.0（对于 100%））的速率。 | 
| filledDuration | 数字 | true | 所有插入到效用中的广告的持续时间的总和。 | 
| numAds | 数字 | true | 广告中 MediaTailor 插入的广告数量。 | 
| originAvailDuration | 数字 | true | 来源（CUE\$1OUT 或 SCTE）中的内容流指定的效用的持续时间。 | 
| skippedAds | [skippedAd](#ads-logs-skippedAd) 类型的数组 | false | 由于TRANSCODE\$1IN\$1PROGRESS和之类的原因， MediaTailor 未插入的广告TRANSCODE\$1ERROR。有关跳过广告的原因列表，请参阅[跳过广告疑难解答](troubleshooting-ad-skipping-overview.md)。 | 
| slateAd | [slateAd](#ads-logs-slateAd) 类型的对象 | true | 有关 slate 广告的信息，该广告 MediaTailor 用于填充可用区中任何未填充的细分。 | 

### creativeAd
<a name="ads-logs-creativeAd"></a>

此部分描述了 ADS 日志 creativeAd 的属性。


**ADS 日志 creativeAd 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| adContent | [adContent](#ads-logs-adContent) 类型的对象 | true | 有关已插入广告的内容的信息。 | 
| creativeUniqueId | 字符串 | true | 广告的唯一标识符，用作转码的密钥。这是 VAST 响应中广告素材的 ID 字段（如果可用）。否则，它是广告的 Mezzanine URL。 | 
| trackingEvents | [trackingEvents](#ads-logs-trackingEvents) 类型的对象 | true | 广告各种跟踪事件 URLs 的跟踪信标。键是事件名称，值是信标列表 URLs。 | 
| transcodedAdDuration | 数字 | true | 从转码资产计算的广告持续时间。 | 
| uri | 字符串 | true | Mezzanine 广告的 URL，这是转码器的输入。 | 
| vastDuration | 数字 | true | 广告的持续时间（从 VAST 响应解析）。 | 

### requestheaders
<a name="ads-logs-requestheaders"></a>

此部分描述了 ADS 日志 requestheaders 的属性。


**ADS 日志 requestheaders 属性**  

| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| name | 字符串 | true | 标头的名称。 | 
| value | 字符串 | true | 标头的值。 | 

### skippedAd
<a name="ads-logs-skippedAd"></a>

此部分描述了 ADS 日志 skippedAd 的属性。


**ADS 日志 skippedAd 属性**  

| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| adMezzanineUrl | 字符串 | true | 跳过的广告的 Mezzanine URL。 | 
| creativeUniqueId | 字符串 | true | 广告的唯一标识符，用作转码的密钥。这是 VAST 响应中广告素材的 ID 字段（如果可用）。否则，它是广告的 Mezzanine URL。 | 
| skippedReason | 字符串 | true | 用于指示未插入广告的原因的代码。示例：TRANSCODE\$1IN\$1PROGRESS。有关跳过广告的原因列表，请参阅[跳过广告疑难解答](troubleshooting-ad-skipping-overview.md)。 | 
| transcodedAdDuration | 数字 | false | 从转码资产计算的广告持续时间。 | 
| vastDuration | 数字 | true | 广告的持续时间（从 VAST 响应解析）。 | 

### slateAd
<a name="ads-logs-slateAd"></a>

此部分描述了 ADS 日志 slateAd 的属性。


**ADS 日志 slateAd 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| adContent | [adContent](#ads-logs-adContent) 类型的对象 | true | 有关已插入广告的内容的信息。 | 
| creativeUniqueId | 字符串 | true | 广告的唯一标识符，用作转码的密钥。这是 VAST 响应中广告素材的 ID 字段（如果可用）。否则，它是广告的 Mezzanine URL。 | 
| transcodedAdDuration | 数字 | true | 从转码资产计算的广告持续时间。 | 
| uri | 字符串 | true | Mezzanine 广告的 URL，这是转码器的输入。 | 

### trackingEvents
<a name="ads-logs-trackingEvents"></a>

此部分描述了 ADS 日志 trackingEvents 的属性。


**ADS 日志 trackingEvents 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| <any string> | 字符串类型的数组 | false | 指定跟踪事件（展示次数、完成事件等）的信标 URLs 列表 | 

### vastAd
<a name="ads-logs-vastAd"></a>

此部分描述了 ADS 日志 vastAd 的属性。


**ADS 日志 vastAd 属性**  

| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| adSystem | 字符串 | true | VAST 响应中 AdSystem 标签的值。 | 
| adTitle | 字符串 | true | VAST 响应中对广告可用的媒体文件。 | 
| creativeAdId | 字符串 | true | VAST 响应中 Creative 标签的 adId 属性的值。 | 
| creativeId | 字符串 | true | VAST 响应中 Creative 标签的 id 属性的值。 | 
| duration | 数字 | true | 广告的大致持续时间，基于 VAST 响应中 linear 元素的 duration 标签。 | 
| trackingEvents | [trackingEvents](#ads-logs-trackingEvents) 类型的对象 | true | 广告各种跟踪事件 URLs 的跟踪信标。键是事件名称，值是信标列表 URLs。 | 
| vastAdId | 字符串 | true | VAST 响应中 Ad 标签的 id 属性的值。 | 
| vastAdTagUri | 字符串 | false | 广告的特定于 VMAP 的重定向 URI。 | 
| vastMediaFiles | [vastMediaFile](#ads-logs-vastMediaFile) 类型的数组 | true | VAST 响应中对广告可用的媒体文件的列表。 | 

### vastMediaFile
<a name="ads-logs-vastMediaFile"></a>

本节介绍了 ADS 日志的属性 vastMediaFile。


**ADS 日志 vastMediaFile 属性**  

| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| apiFramework | 字符串 | true | 管理媒体文件所需的 API 框架。示例：VPAID。 | 
| bitrate | 数字 | true | 媒体文件的比特率。 | 
| delivery | 字符串 | true | 用于媒体文件的协议，设置为渐进式或流式传输。 | 
| height | 数字 | true | 媒体文件的像素高度。 | 
| id | 字符串 | true | MediaFile 标签的 id 属性的值。 | 
| type | 字符串 | true | 媒体文件的 MIME 类型，取自 MediaFile 标签的 type 属性。 | 
| uri | 字符串 | true | Mezzanine 广告的 URL，这是转码器的输入。 | 
| width | 数字 | true | 媒体文件的像素宽度。 | 

### vastResponse
<a name="ads-logs-vastResponse"></a>

此部分描述了 ADS 日志 vastResponse 的属性。


**ADS 日志 vastResponse 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| errors | 字符串类型的数组 | true | 从 VAST 响应中的Error标签中 URLs 解析出来的错误。 | 
| vastAds | [vastAd](#ads-logs-vastAd) 类型的数组 | true | 从 VAST 响应解析的广告。 | 
| version | 字符串 | true | VAST 规范版本（从响应中 VAST 标签的 version 属性解析）。 | 

### vodCreativeOffsets
<a name="ads-logs-vodCreativeOffsets"></a>

本节介绍了 ADS 日志的属性 vodCreativeOffsets。


**ADS 日志 vodCreativeOffsets 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| <any string> | [vodCreativeOffset](#ads-logs-vodCreativeOffset) 类型的数组 | false | 从清单中的时间偏差到此时要插入的广告列表的映射。 | 

### vodCreativeOffset
<a name="ads-logs-vodCreativeOffset"></a>

本节介绍了 ADS 日志的属性 vodCreativeOffset。


**ADS 日志 vodCreativeOffset 属性**  

| 属性 | Type | 必需 | 说明 | 
| --- | --- | --- | --- | 
| adContent | [adContent](#ads-logs-adContent) 类型的对象 | true | 有关已插入广告的内容的信息。 | 
| creativeUniqueId | 字符串 | true | 广告的唯一标识符，用作转码的密钥。这是 VAST 响应中广告素材的 ID 字段（如果可用）。否则，它是广告的 Mezzanine URL。 | 
| trackingEvents | [trackingEvents](#ads-logs-trackingEvents) 类型的对象 | true | 广告各种跟踪事件 URLs 的跟踪信标。键是事件名称，值是信标列表 URLs。 | 
| transcodedAdDuration | 数字 | true | 从转码资产计算的广告持续时间。 | 
| uri | 字符串 | true | Mezzanine 广告的 URL，这是转码器的输入。 | 
| vastDuration | 数字 | true | 广告的持续时间（从 VAST 响应解析）。 | 

## 广告日志 JSON 架构
<a name="ads-log-json-schema"></a>

下面列出了 AWS Elemental MediaTailor ADS 日志的 JSON 架构。

```
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://amazon.com/elemental/midas/mms/adsLogSchema.json",
  "type": "object",
  "title": "AWS Elemental MediaTailor ADS Log JSON Schema",
  "required": [
    "eventType",
    "eventTimestamp",
    "requestId",
    "sessionType",
    "eventDescription",
    "awsAccountId",
    "customerId",
    "originId",
    "sessionId"
  ],
  "additionalProperties": false,
  "properties": {
    "eventType": {
      "$id": "#/properties/eventType",
      "type": "string",
      "description": "The code for the event that triggered this log message. Example: <code>VAST_RESPONSE</code>.",
      "examples": [
        "FILLED_AVAIL"
      ]
    },
    "eventTimestamp": {
      "$id": "#/properties/eventTimestamp",
      "type": "string",
      "description": "The date and time of the event.",
      "examples": [
        "1970-01-01T00:00:00Z"
      ],
      "format": "date-time"
    },
    "requestId": {
      "$id": "#/properties/requestId",
      "type": "string",
      "description": "The MediaTailor request ID, which you can use to correlate multiple log entries for the same request.",
      "examples": [
        "c7c7ae8c-a61e-44e0-8efd-7723995337a1"
      ],
      "pattern": "^(.*)$"
    },
    "sessionType": {
      "$id": "#/properties/sessionType",
      "type": "string",
      "enum": [
        "HLS",
        "DASH"
      ],
      "description": "The player's stream type."
    },
    "eventDescription": {
      "$id": "#/properties/eventDescription",
      "type": "string",
      "description": "A short description of the event that triggered this log message, provided by the MediaTailor service. By default, this is empty. Example: <code>Got VAST response</code>.",
      "default": "",
      "examples": [
        "Got VAST response"
      ],
      "pattern": "^(.*)$"
    },
    "awsAccountId": {
      "$id": "#/properties/awsAccountId",
      "type": "string",
      "description": "The AWS account ID for the MediaTailor configuration that was used for the session."
    },
    "customerId": {
      "$id": "#/properties/customerId",
      "type": "string",
      "description": "The hashed version of the AWS account ID, which you can use to correlate multiple log entries.",
      "pattern": "^(.*)$"
    },
    "originId": {
      "$id": "#/properties/originId",
      "type": "string",
      "description": "The configuration name from the MediaTailor configuration. This is different from the video content source, which is also part of the configuration.",
      "examples": [
        "external-canary-dash-serverside-reporting-onebox"
      ],
      "pattern": "^(.*)$"
    },
    "sessionId": {
      "$id": "#/properties/sessionId",
      "type": "string",
      "description": "The unique numeric identifier that MediaTailor assigned to the player session. All requests that a player makes for a session have the same session ID. Example: <code>e039fd39-09f0-46b2-aca9-9871cc116cde</code>.",
      "examples": [
        "120b9873-c007-40c8-b3db-0f1bd194970b"
      ],
      "pattern": "^(.*)$"
    },
    "avail": {
      "$id": "#/properties/avail",
      "type": "object",
      "title": "avail",
      "description": "Information about an avail that MediaTailor fills with ads. Currently, for the <code>FILLED_AVAIL</code> event type, this is the plan created by MediaTailor when it first encounters the avail. How the avail is eventually filled may vary from this plan, depending on how the content plays out.  ",
      "required": [
        "creativeAds",
        "originAvailDuration",
        "filledDuration",
        "fillRate",
        "driftMillisecondsAtAvailStart",
        "numAds",
        "slateAd",
        "availId"
      ],
      "additionalProperties":  false,
      "properties": {
        "originAvailDuration": {
          "$id": "#/properties/avail/originAvailDuration",
          "type": "number",
          "description": "The duration of the avail as specified in the content stream from the origin (<code>CUE_OUT</code> or <code>SCTE</code>)."
        },
        "filledDuration": {
          "$id": "#/properties/avail/filledDuration",
          "type": "number",
          "description": "The sum of the durations of all the ads inserted into the avail."
        },
        "fillRate": {
          "$id": "#/properties/avail/fillRate",
          "type": "number",
          "description": "The rate at which the ads fill the avail duration, from 0.0 (for 0%) to 1.0 (for 100%)."
        },
        "driftMillisecondsAtAvailStart": {
          "$id": "#/properties/avail/driftMillisecondsAtAvailStart",
          "type": "number",
          "description": "The cumulative drift at the beginning of this avail. A positive value implies that we are moving away from the live edge, a negative value implies that we are moving towards the live edge."
        },
        "creativeAds": {
          "$id": "#/properties/avail/creativeAds",
          "type": "array",
          "description": "The ads that MediaTailor inserted into the avail.",
          "items": {
            "type": "object",
            "title": "creativeAd",
            "description": "Information about a single inserted ad.",
            "required": [
              "uri",
              "creativeUniqueId",
              "adSystem",
              "adContent",
              "trackingEvents",
              "vastDuration",
              "transcodedAdDuration"
            ],
            "additionalProperties": false,
            "properties": {
              "uri": { "$ref": "#/definitions/adMezzanineUri" },
              "creativeUniqueId": { "$ref": "#/definitions/creativeUniqueId" },
              "adSystem": { "$ref": "#/definitions/adSystem" },
              "adContent": { "$ref": "#/definitions/adContent" },
              "trackingEvents": { "$ref": "#/definitions/trackingEvents" },
              "vastDuration": { "$ref": "#/definitions/vastDuration" },
              "transcodedAdDuration": { "$ref": "#/definitions/transcodedAdDuration" }
            }
          }
        },
        "numAds": {
          "$id": "#/properties/avail/numAds",
          "type": "number",
          "description": "The number of ads that MediaTailor inserted into the avail."
        },
        "slateAd": {
          "$id": "#/properties/avail/slateAd",
          "type": ["object", "null"],
          "title": "slateAd",
          "description": "Information about the slate ad, which MediaTailor uses to fill any unfilled segments in the avail.",
          "additionalProperties": false,
          "required": [
            "uri",
            "creativeUniqueId",
            "adContent",
            "transcodedAdDuration"
          ],
          "properties": {
            "uri": { "$ref": "#/definitions/adMezzanineUri" },
            "creativeUniqueId": { "$ref": "#/definitions/creativeUniqueId" },
            "adContent": { "$ref": "#/definitions/adContent" },
            "transcodedAdDuration": { "$ref": "#/definitions/transcodedAdDuration" }
          }
        },
        "availId": {
          "$id": "#/properties/avail/availId",
          "type": "string",
          "description": "The unique identifier for this avail. For HLS, this is the media sequence number where the avail begins. For DASH, this is the period ID."
        },
        "skippedAds": {
          "$id": "#/properties/avail/skippedAds",
          "type": "array",
          "description": "The ads that MediaTailor didn't insert, for reasons like <code>TRANSCODE_IN_PROGRESS</code> and <code>TRANSCODE_ERROR</code>.",
          "items": {
            "type": "object",
            "title": "skippedAd",
            "description": "Information about a single skipped ad.",
            "required": [
              "creativeUniqueId",
              "adMezzanineUrl",
              "skippedReason",
              "vastDuration"
            ],
            "additionalProperties": false,
            "properties": {
              "creativeUniqueId": { "$ref": "#/definitions/creativeUniqueId" },
              "adMezzanineUrl": {
                "type": "string",
                "description": "The mezzanine URL of the skipped ad."
              },
              "skippedReason": {
                "type": "string",
                "description": "The code that indicates why the ad wasn't inserted. Example: <code>TRANSCODE_IN_PROGRESS</code>."
              },
              "vastDuration": { "$ref": "#/definitions/vastDuration" },
              "transcodedAdDuration": { "$ref": "#/definitions/transcodedAdDuration" },
              "targetVariant": {
                "type": "object",
                "title": "targetVariant",
                "description": "The target variant of the source content. This key is present when an ad wasn't inserted due to the source content containing a variant that could not match to any variants present in this ad.",
                "required": [
                  "mediaProtocol",
                  "mediaType",
                  "bitrate",
                  "mediaResolution",
                  "codecs"
                ],
                "additionalProperties": false,
                "properties": {
                  "mediaProtocol": {
                    "type": "string",
                    "description": "The media protocol of this variant, such as HLS.",
                    "enum": [
                      "HLS",
                      "DASH"
                    ]
                  },
                  "mediaType": {
                    "type": "array",
                    "description": "The media type of this variant, such as VIDEO.",
                    "items": {
                      "type": "string",
                      "enum": [
                        "VIDEO",
                        "AUDIO",
                        "SUBTITLES",
                        "TRICK_PLAY"
                      ],
                      "description": "Media type, such as VIDEO."
                    }
                  },
                  "bitrate": {
                    "$ref": "#/definitions/bitrate"
                  },
                  "mediaResolution": {
                    "type": "object",
                    "title": "mediaResolution",
                    "description": "The media resolution of this variant.",
                    "required": [
                      "width",
                      "height"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "width": {
                        "$ref": "#/definitions/width"
                      },
                      "height": {
                        "$ref": "#/definitions/height"
                      }
                    }
                  },
                  "codecs": {
                    "type": "array",
                    "description": "The codecs of this variant.",
                    "items": {
                      "type": "string",
                      "description": "Codec, such as avc1."
                    }
                  }
                }
              }
            }
          }
        },
        "adBreakTrackingEvents": {
          "$id": "#properties/avail/adBreakTrackingEvents",
          "type": "object",
          "title": "adBreakTrackingEvents",
          "description": "VMAP/ad break tracking events and corresponding URL",
          "properties": {
            "items": {
              "$ref": "#/definitions/adBreakTrackingEvents"
            }
          }
        }
      }
    },

    "vastResponse": {
      "$id": "#/properties/vastResponse",
      "type": "object",
      "title": "vastResponse",
      "description": "Information about the VAST response that MediaTailor received from the ADS.",
      "required": [
        "version",
        "vastAds",
        "errors",
        "nonLinearAdsList"
      ],
      "additionalProperties":  false,
      "properties": {
        "version": {
          "$id": "#/properties/vastResponse/version",
          "type": "string",
          "description": "The VAST specification version, parsed from the <code>version</code> attribute of the <code>VAST</code> tag in the response.",
          "examples": [
            "3.0"
          ],
          "pattern": "^(.*)$"
        },
        "vastAds": {
          "$id": "#/properties/vastResponse/vastAds",
          "type": "array",
          "description": "The ads parsed from the VAST response.",
          "items": {
            "$ref": "#/definitions/vastAd"
          }
        },
        "errors": {
          "$id": "#/properties/vastResponse/errors",
          "type": "array",
          "description": "The error URLs parsed from the <code>Error</code> tags in the VAST response.",
          "items": {
            "type": "string",
            "description": "A single error URL."
          }
        },
        "nonLinearAdsList": {
          "$id": "#/properties/vastResponse/nonLinearAds",
          "type": "array",
          "description": "A list of NonLinearAds as they are read from the VAST response.",
          "items": {
            "$ref": "#/definitions/nonLinearAds"
          }
        }
      }
    },

    "vastAd": {
      "$ref": "#/definitions/vastAd"
    },

    "vodVastResponseTimeOffset": {
      "$id": "#/properties/vodVastResponseTimeOffset",
      "type": "number",
      "description": "The VMAP specific time offset for VOD ad insertion.",
      "examples": [
        5.0
      ]
    },

    "vodCreativeOffsets": {
      "$id": "#/properties/vodCreativeOffsets",
      "type": "object",
      "title": "vodCreativeOffsets",
      "description": "A map that indicates the time offsets in the manifest where MediaTailor will insert avails, based on the VMAP response.",
      "additionalProperties": {
        "type": "array",
        "$id": "#/properties/vodCreativeOffsets/entry",
        "description": "A mapping from a time offset in the manifest to a list of ads to insert at this time.",
        "items": {
          "type": "object",
          "$id": "#/properties/vodCreativeOffsets/entry/items",
          "title": "vodCreativeOffset",
          "description": "The list of ads to insert at the specified time offset.",
          "additionalProperties": false,
          "required": [
            "uri",
            "creativeUniqueId",
            "vastDuration",
            "transcodedAdDuration",
            "adContent",
            "trackingEvents"
          ],
          "properties": {
            "uri": { "$ref": "#/definitions/adMezzanineUri" },
            "creativeUniqueId": { "$ref": "#/definitions/creativeUniqueId" },
            "vastDuration": { "$ref": "#/definitions/vastDuration" },
            "transcodedAdDuration": { "$ref": "#/definitions/transcodedAdDuration" },
            "adContent": { "$ref": "#/definitions/adContent" },
            "trackingEvents": { "$ref": "#/definitions/trackingEvents" }
          }
        }
      }
    },

    "adsRequestUrl": {
      "$id": "#/properties/adsRequestUrl",
      "type": "string",
      "description": "The full URL of the ADS request made by MediaTailor."
    },
    "adMarkers": {
      "$id": "#/properties/adMarkers",
      "type": "string",
      "description": "Found Ad Marker in the Manifest."
    },
    "segmentationUpid": {
      "$id": "#/properties/segmentationUpid",
      "type": "string",
      "description": "Value of segmentation upid parsed from ad markers in manifest."
    },
    "segmentationTypeId": {
      "$id": "#/properties/segmentationTypeId",
      "type": "integer",
      "description": "Value of segmentation typeId parsed from ad markers in manifest."
    },
    "requestHeaders": {
      "$id": "#/properties/requestHeaders",
      "type": "array",
      "description": "The headers that MediaTailor included with the ADS request. Typically, the logs include these when a request to the ADS fails, to help with troubleshooting.",
      "items": {
        "type": "object",
        "title": "requestheaders",
        "description": "The name and value for a single header included in the ADS request.",
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the header."
          },
          "value": {
            "type": "string",
            "description": "The value of the header."
          }
        }
      }
    },

    "originalTargetUrl": {
      "$id": "#/properties/originalTargetUrl",
      "type": "string",
      "description": "The old URL to which MediaTailor was going to make a request."
    },
    "prefetchScheduleName": {
      "$id": "#/properties/prefetchScheduleName",
      "type": "string",
      "description": "The name of the prefetch schedule associated with this ad event.",
      "examples": [
        "PrefetchScheduleName"
      ],
      "pattern": "^(.*)$"
    },
    "updatedTargetUrl": {
      "$id": "#/properties/updatedTargetUrl",
      "type": "string",
      "description": "The new URL to which MediaTailor is making a request."
    },

    "rawAdsResponse": {
      "$id": "#/properties/rawAdsResponse",
      "type": "string",
      "description": "Paginated ADS response as it's exactly returned to MediaTailor."
    },
    "rawAdsResponseIndex": {
      "$id": "#/properties/rawAdsResponseIndex",
      "type": "integer",
      "description": "Integer value denoting this rawAdsResponse's index into the full ADS response. This value is used to order the paginated messages for this ADS response."
    }
  },

  "__COMMENT_oneOf": "The oneOf section defines subtypes for our events. Subtypes can have different rules, including which fields are required. For more information, see https://json-schema.org/understanding-json-schema/reference/combining.html#oneof ",

  "oneOf": [
    { "$ref": "#/definitions/eventAdMarkersFound" },
    { "$ref": "#/definitions/eventNonAdMarkerFound" },
    { "$ref": "#/definitions/eventMakingAdsRequest" },
    { "$ref": "#/definitions/eventModifiedTargetUrl" },
    { "$ref": "#/definitions/eventRawAdsResponse" },
    { "$ref": "#/definitions/eventVastResponse" },
    { "$ref": "#/definitions/eventFilledAvail" },
    { "$ref": "#/definitions/eventFilledOverlayAvail" },
    { "$ref": "#/definitions/eventErrorFiringBeaconFailed" },
    { "$ref": "#/definitions/eventWarningNoAdvertisements" },
    { "$ref": "#/definitions/eventUnknownHost" },
    { "$ref": "#/definitions/eventErrorAdsTimeout" },
    { "$ref": "#/definitions/eventErrorVastMissingOverlays" },
    { "$ref": "#/definitions/eventPlannedAvail" },
    { "$ref": "#/definitions/eventEmptyVastResponse" },
    { "$ref": "#/definitions/eventEmptyVmapResponse" },
    { "$ref": "#/definitions/eventErrorUnknown" },
    { "$ref": "#/definitions/eventVastRedirect" },
    { "$ref": "#/definitions/eventRedirectedVastResponse" },
    { "$ref": "#/definitions/eventErrorAdsMissingImpression" },
    { "$ref": "#/definitions/eventErrorAdsResponseParse" },
    { "$ref": "#/definitions/eventErrorAdsInvalidResponse" },
    { "$ref": "#/definitions/eventErrorDisallowedHost"},
    { "$ref": "#/definitions/eventPersonalizationDisabled"},
    { "$ref": "#/definitions/eventWarningDynamicVariableSubFailed"},
    { "$ref": "#/definitions/eventVodTimeBasedAvailPlanVastResponseForOffset" },
    { "$ref": "#/definitions/eventVodTimeBasedAvailPlanSuccess" }
  ],

  "definitions": {
    "eventAdMarkersFound": {
      "$id": "#/definitions/eventAdMarkersFound",
      "required": [
        "eventType",
        "adMarkers"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "AD_MARKER_FOUND"
        }
      }
    },
    "eventNonAdMarkerFound": {
      "$id": "#/definitions/eventNonAdMarkerFound",
      "required": [
        "eventType",
        "adMarkers"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "NON_AD_MARKER_FOUND"
        }
      }
    },
    "eventMakingAdsRequest": {
      "$id": "#/definitions/eventMakingAdsRequest",
      "required": [
        "eventType",
        "adsRequestUrl"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "MAKING_ADS_REQUEST"
        }
      }
    },

    "eventModifiedTargetUrl": {
      "$id": "#/definitions/eventModifiedTargetUrl",
      "required": [
        "eventType",
        "originalTargetUrl",
        "updatedTargetUrl"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "MODIFIED_TARGET_URL"
        }
      }
    },

    "eventRawAdsResponse": {
      "$id": "#/definitions/eventRawAdsResponse",
      "required": [
        "eventType",
        "rawAdsResponse",
        "rawAdsResponseIndex"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "RAW_ADS_RESPONSE"
        }
      }
    },

    "eventVastResponse": {
      "$id": "#/definitions/eventVastResponse",
      "_comment": "NOTE: the vastResponse property should ideally be marked as a required field for this event, but unfortunately, in the case of an empty vast response, we currently emit an EMPTY_VAST_RESPONSE followed by a VAST_RESPONSE, and the vastResponse property is not present in the latter. We need to fix this so that we don't emit both of those events in the empty response case, and update this schema to flag vastResponse as required for VAST_RESPONSE.",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "VAST_RESPONSE"
        }
      }
    },

    "eventFilledAvail": {
      "$id": "#/definitions/eventFilledAvail",
      "required": [
        "eventType",
        "avail"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "FILLED_AVAIL"
        }
      }
    },

    "eventFilledOverlayAvail": {
      "$id": "#/definitions/eventFilledOverlayAvail",
      "required": [
        "eventType",
        "avail"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "FILLED_OVERLAY_AVAIL"
        }
      }
    },

    "eventErrorVastMissingOverlays": {
      "$id": "#/definitions/eventErrorVastMissingOverlays",
      "required": [
        "eventType",
        "adsRequestUrl",
        "requestHeaders"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_VAST_MISSING_OVERLAYS"
        }
      }
    },

    "eventErrorFiringBeaconFailed": {
      "$id": "#/definitions/eventErrorFiringBeaconFailed",
      "required": [
        "eventType",
        "error",
        "beaconInfo"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_FIRING_BEACON_FAILED"
        }
      }
    },

    "eventWarningNoAdvertisements": {
      "$id": "#/definitions/eventWarningNoAdvertisements",
      "required": [
        "eventType"
      ],
      "_comment": "We should really have a more descriptive error field for these events",
      "properties": {
        "eventType": {
          "type": "string",
          "const": "WARNING_NO_ADVERTISEMENTS"
        }
      }
    },

    "eventUnknownHost": {
      "$id": "#/definitions/eventUnknownHost",
      "required": [
        "eventType",
        "requestHeaders"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_UNKNOWN_HOST"
        }
      }
    },

    "eventErrorAdsTimeout": {
      "$id": "#/definitions/eventErrorAdsTimeout",
      "required": [
        "eventType",
        "adsRequestUrl",
        "requestHeaders"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_ADS_TIMEOUT"
        }
      }
    },

    "eventPlannedAvail": {
      "$id": "#/definitions/eventPlannedAvail",
      "required": [
        "eventType"
      ],
      "_comment": "TODO: Flesh this out as we implement it",
      "properties": {
        "eventType": {
          "type": "string",
          "const": "PLANNED_AVAIL"
        }
      }
    },

    "eventEmptyVastResponse": {
      "$id": "#/definitions/eventEmptyVastResponse",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "EMPTY_VAST_RESPONSE"
        }
      }
    },

    "eventEmptyVmapResponse": {
      "$id": "#/definitions/eventEmptyVmapResponse",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "EMPTY_VMAP_RESPONSE"
        }
      }
    },

    "eventErrorUnknown": {
      "$id": "#/definitions/eventErrorUnknown",
      "required": [
        "eventType"
      ],
      "_comment": "TODO: we should have a field for the exception message or something",
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_UNKNOWN"
        }
      }
    },

    "eventVastRedirect": {
      "$id": "#/definitions/eventVastRedirect",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "VAST_REDIRECT"
        }
      }
    },

    "eventRedirectedVastResponse": {
      "$id": "#/definitions/eventRedirectedVastResponse",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "REDIRECTED_VAST_RESPONSE"
        }
      },
      "_comment": "NOTE that the property vastResponse is not required because empty vast responses do not contain a vastResponse."
    },

    "eventErrorAdsResponseParse": {
      "$id": "#/definitions/eventErrorAdsResponseParse",
      "required": [
        "eventType"
      ],
      "_comment": "We should have a field with an error message here",
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_ADS_RESPONSE_PARSE"
        }
      }
    },

    "eventErrorAdsInvalidResponse": {
      "$id": "#/definitions/eventErrorAdsInvalidResponse",
      "required": [
        "eventType",
        "additionalInfo"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_ADS_INVALID_RESPONSE"
        }
      }
    },

    "eventErrorAdsMissingImpression": {
      "$id": "#/definitions/eventErrorAdsMissingImpression",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_VAST_MISSING_IMPRESSION"
        }
      }
    },

    "eventErrorDisallowedHost": {
      "$id": "#/definitions/eventErrorDisallowedHost",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_DISALLOWED_HOST"
        }
      }
    },

    "eventPersonalizationDisabled": {
      "$id": "#/definitions/eventPersonalizationDisabled",
      "required": [
        "eventType"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "ERROR_PERSONALIZATION_DISABLED"
        }
      }
    },

    "eventWarningDynamicVariableSubFailed": {
      "$id": "#/definitions/eventWarningDynamicVariableSubFailed",
      "required": [
        "eventType",
        "adsRequestUrl"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "WARNING_URL_VARIABLE_SUBSTITUTION_FAILED"
        }
      }
    },

    "eventVodTimeBasedAvailPlanVastResponseForOffset": {
      "$id": "#/definitions/eventVodTimeBasedAvailPlanVastResponseForOffset",
      "required": [
        "eventType",
        "vastResponse"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "VOD_TIME_BASED_AVAIL_PLAN_VAST_RESPONSE_FOR_OFFSET"
        }
      }
    },

    "eventVodTimeBasedAvailPlanSuccess": {
      "$id": "#/definitions/eventVodTimeBasedAvailPlanSuccess",
      "required": [
        "eventType",
        "vodCreativeOffsets"
      ],
      "properties": {
        "eventType": {
          "type": "string",
          "const": "VOD_TIME_BASED_AVAIL_PLAN_SUCCESS"
        }
      }
    },

    "creativeUniqueId": {
      "type": "string",
      "description": "The unique identifier for the ad, used as a key for transcoding. This is the ID field for the creative in the VAST response, if available. Otherwise, it's the mezzanine URL of the ad. "
    },

    "adSystem": {
      "type": "string",
      "description": "The value of the <code>AdSystem</code> tag in the VAST response. "
    },

    "vastDuration": {
      "type": "number",
      "description": "The duration of the ad, as parsed from the VAST response."
    },

    "transcodedAdDuration": {
      "type": "number",
      "description": "The duration of the ad, calculated from the transcoded asset."
    },

    "adContent": {
      "$id": "#/properties/adContent",
      "type": ["object", "null"],
      "title": "adContent",
      "description": "Information about the content of the inserted ad.",
      "additionalProperties": false,
      "properties": {
        "adPlaylistUris": {
          "$id": "#/properties/adContent/adPlaylistUris",
          "type": "object",
          "title": "adPlaylistUris",
          "description": "The mapping from the origin manifest for a variant to the ad manifest for the variant. For DASH, this contains a single entry, because all variants are represented in a single DASH manifest. ",
          "additionalProperties": {
            "$id": "#/properties/adContent/adPlaylistUris/adPlaylistUri",
            "type": "string",
            "description": "The URL of the ad manifest for the specific variant."
          }
        }
      }
    },

    "adMezzanineUri": {
      "type": "string",
      "description": "The URL of the mezzanine version of the ad, which is the input to the transcoder."
    },

    "bitrate": {
      "type": "integer",
      "examples": [
        533
      ],
      "description": "The bitrate."
    },
    "width": {
      "type": "integer",
      "examples": [
        1280
      ],
      "description": "Width in pixels."
    },
    "height": {
      "type": "integer",
      "examples": [
        720
      ],
      "description": "Height in pixels."
    },

    "trackingEvents": {
      "type": "object",
      "title": "trackingEvents",
      "description": "The tracking beacon URLs for the various tracking events for the ad. The keys are the event names, and the values are a list of beacon URLs.",

      "additionalProperties":  {
        "type": "array",
        "description": "The list of beacon URLs for the specified tracking event (impression, complete, and so on)",
        "items": {
          "type": "string",
          "description": "The beacon URLs for this tracking event."
        }
      }
    },

    "nonLinearAds": {
      "$id": "#/properties/nonLinearAds",
      "type": "object",
      "title": "nonLinearAds",
      "description": "A NonLinearAds as it appears in the VAST response.",
      "required": [
        "nonLinearAdList",
        "nonLinearTrackingEvents"
      ],
      "properties": {
        "nonLinearAdList": {
          "type": "array",
          "description": "List of non linear ads as they exist within one NonLinearAds.",
          "items": {
            "type": "object",
            "title": "nonLinearAdList",
            "description": "List of NonLinearAd as they are parsed from its parent NonLinearAds.",
            "properties": {
              "nonLinearAdId": {
                "type": "string",
                "description": "Ad ID of this non linear ad."
              },
              "nonLinearAdSystem": {
                "type": "string",
                "description": "Ad system of this non linear ad's parent Inline ad."
              },
              "nonLinearAdTitle": {
                "type": "string",
                "description": "Ad title of this non linear ad's parent Inline ad."
              },
              "nonLinearCreativeId": {
                "type": "string",
                "description": "Creative ID of this non linear ad's parent Creative ad."
              },
              "nonLinearCreativeAdId": {
                "type": "string",
                "description": "Creative ad ID of this non linear ad."
              },
              "nonLinearCreativeSequence": {
                "type": "string",
                "description": "Creative sequence of this non linear ad."
              },
              "nonLinearWidth": {
                "type": "string",
                "description": "Width of this non linear ad."
              },
              "nonLinearHeight": {
                "type": "string",
                "description": "Height of this non linear ad."
              },
              "nonLinearExpandedWidth": {
                "type": "string",
                "description": "Expanded width of this non linear ad."
              },
              "nonLinearExpandedHeight": {
                "type": "string",
                "description": "Expanded height of this non linear ad."
              },
              "nonLinearScalable": {
                "type": "boolean",
                "description": "Boolean denoting if this non linear ad is scalable."
              },
              "nonLinearMaintainAspectRatio": {
                "type": "boolean",
                "description": "Boolean denoting if aspect ratio should be maintained for this non linear ad."
              },
              "nonLinearMinSuggestedDuration": {
                "type": "string",
                "description": "Min suggested duration for this non linear ad."
              },
              "nonLinearApiFramework": {
                "type": "string",
                "description": "API framework for this non linear ad's parent Inline ad."
              },
              "nonLinearStaticResource": {
                "type": "string",
                "description": "Static resource for this non linear ad."
              },
              "nonLinearStaticResourceCreativeType": {
                "type": "string",
                "description": "Static Resource creative type for this non linear ad."
              },
              "nonLinearIFrameResource": {
                "type": "string",
                "description": "I-Frame resource for this non linear ad."
              },
              "nonLinearHtmlResource": {
                "type": "string",
                "description": "HTML resource for this non linear ad."
              },
              "nonLinearAdParameters": {
                "type": "string",
                "description": "Ad parameters for this non linear ad."
              },
              "nonLinearClickThrough": {
                "type": "string",
                "description": "Click Through data for this non linear ad."
              },
              "nonLinearClickTracking": {
                "type": "string",
                "description": "Click Tracking data for this non linear ad."
              },
              "nonLinearClickTrackingId": {
                "type": "string",
                "description": "Click Tracking ID for this non linear ad."
              }
            }
          }
        },
        "nonLinearTrackingEvents": { "$ref": "#/definitions/trackingEvents" },
        "extensions": {
          "$id": "#/properties/nonLinearAds/extensions",
          "type": "array",
          "description": "Extensions that exist for this NonLinearAds.",
          "items": {
            "$id": "#/properties/nonLinearAds/extensions/items",
            "type": "object",
            "title": "Extensions",
            "description": "Extensions found in non linear ads",
            "additionalProperties":  false,
            "properties": {
              "extensionType": {
                "$id": "#/properties/nonLinearAds/extensions/extensionType",
                "type": "string",
                "description": "The value of the extension type attribute of the <code>Extensions</code> tag.",
                "examples": [
                  "FreeWheel"
                ]
              },
              "extensionContent": {
                "$id": "#/properties/nonLinearAds/extensions/extensionContent",
                "type": "string",
                "description": "The extension content attribute of the <code>Extensions</code> tag.",
                "examples": [
                  "progressive"
                ]
              }
            }
          }
        }
      }
    },
    "adBreakTrackingEvents": {
      "$id": "#/properites/adBreakTrackingEvents",
      "type": "object",
      "title": "adBreakTrackingEvents",
      "description": "These are all VMAP ad break tracking events.",
      "additionalProperties": {
        "type": "array",
        "description": "VMAP/ad break tracking events and corresponding URL",
        "items": {
          "type": "string",
          "description": "The beacon URLs for this tracking event."
        }
      }
    },
    "vastAd": {
      "$id": "#/properties/vastAd",
      "type": "object",
      "title": "vastAd",
      "description": "Information about a single ad parsed from the VAST response.",
      "required": [
        "vastAdId",
        "adSystem",
        "adTitle",
        "creativeId",
        "creativeAdId",
        "duration",
        "vastMediaFiles",
        "trackingEvents"
      ],
      "additionalProperties":  false,
      "properties": {
        "vastAdId": {
          "$id": "#/properties/vastAd/vastAdId",
          "type": "string",
          "description": "The value of the id attribute of the <code>Ad</code> tag in the VAST response",
          "examples": [
            "ad1"
          ]
        },
        "adSystem": {"$ref": "#/definitions/adSystem" } ,
        "adTitle": {
          "$id": "#/properties/vastAd/adTitle",
          "type": "string",
          "description": "The media files that are available for the ad in the VAST response.",
          "examples": [
            "External NCA1C1L1 LinearInlineSkippable"
          ]
        },
        "creativeId": {
          "$id": "#/properties/vastAd/creativeId",
          "type": "string",
          "description": "The value of the id attribute of the <code>Creative</code> tag in the VAST response.",
          "examples": [
            "creative1"
          ]
        },
        "creativeAdId": {
          "$id": "#/properties/vastAd/creativeAdId",
          "type": "string",
          "description": "The value of the adId attribute of the <code>Creative</code> tag in the VAST response."
        },
        "duration": {
          "$id": "#/properties/vastAd/duration",
          "type": "number",
          "description": "The approximate duration of the ad, based on the <code>duration</code> tag in the <code>linear</code> element of the VAST response.",
          "examples": [
            30,
            30.0
          ]
        },
        "vastMediaFiles": {
          "$id": "#/properties/vastAd/vastMediaFiles",
          "type": "array",
          "description": "The list of available media files for the ad in the VAST response.",
          "items": {
            "$id": "#/properties/vastAd/vastMediaFiles/items",
            "type": "object",
            "title": "vastMediaFile",
            "description": "Information about a media file for the ad.",
            "required": [
              "uri",
              "id",
              "delivery",
              "type",
              "apiFramework",
              "width",
              "height",
              "bitrate"
            ],
            "additionalProperties":  false,
            "properties": {
              "uri": { "$ref": "#/definitions/adMezzanineUri" },
              "id": {
                "$id": "#/properties/vastAd/vastMediaFiles/items/properties/id",
                "type": "string",
                "description": "The value of the id attribute of the <code>MediaFile</code> tag.",
                "examples": [
                  "GDFP"
                ]
              },
              "delivery": {
                "$id": "#/properties/vastAd/vastMediaFiles/items/properties/delivery",
                "type": "string",
                "description": "The protocol used for the media file, set to either progressive or streaming.",
                "examples": [
                  "progressive"
                ]
              },
              "type": {
                "$id": "#/properties/vastAd/vastMediaFiles/items/properties/type",
                "type": "string",
                "description": "The MIME type of the media file, taken from the type attribute of the <code>MediaFile</code> tag.",
                "examples": [
                  "video/mp4"
                ]
              },
              "apiFramework": {
                "$id": "#/properties/vastAd/vastMediaFiles/items/properties/apiFramework",
                "type": "string",
                "description": "The API framework needed to manage the media file. Example: <code>VPAID</code>."
              },
              "width": {
                "$ref": "#/definitions/width"
              },
              "height": {
                "$ref": "#/definitions/height"
              },
              "bitrate": {
                "$ref": "#/definitions/bitrate"
              }
            }
          }
        },
        "trackingEvents": { "$ref": "#/definitions/trackingEvents" },
        "vastAdTagUri": {
          "$id": "#/properties/vastAd/vastAdTagUri",
          "type": "string",
          "description": "The VMAP-specific redirect URI for an ad.",
          "examples": [
            "https://ads.redirect.com/redirect1"
          ]
        }
      }
    }
  }
}
```

# AWS Elemental MediaTailor 清单日志、描述和事件类型
<a name="log-types"></a>

以下各节描述了请求和接收清单时为描述源服务器的事件而发 MediaTailor 出的日志。这些是`ManifestService`日志。

**Topics**
+ [ManifestService 事件](#log-types-origininteraction)
+ [清单日志属性](#manifest-logs-main)

## ManifestService 事件
<a name="log-types-origininteraction"></a>

在与原点 MediaTailor 交互时会发出以下事件。


| Log | 说明 | 
| --- | --- | 
| CONFIG\$1SECURITY\$1ERROR | 该 MediaTailor 配置存在安全问题。 | 
| CONFIG\$1SYNTAX\$1ERROR | 来源和资源路径会导致 URL 格式错误。 | 
| CONNECTION\$1ERROR | 与来源的 MediaTailor 连接被拒绝或失败。 | 
| GENERATED\$1MANIFEST | MediaTailor 生成了一份清单。必须启用调试模式才能接收这些日志。有关调试日志模式的信息，包括如何启用该模式，请参阅[生成调试日志](debug-log-mode.md)。 | 
| HOST\$1DISALLOWED | MediaTailor 不允许向该主机发出 HTTP 请求。 | 
| INCOMPATIBLE\$1HLS\$1VERSION | 清单使用不兼容的 HLS 版本。 MediaTailor 需要版本 3 或更高版本。 | 
| INVALID\$1SINGLE\$1PERIOD\$1DASH\$1MANIFEST | 单期 DASH 清单无效。 MediaTailor 正在通过单期 DASH 清单。 | 
| IO\$1ERROR | MediaTailor 在与源服务器通信时遇到 IO 错误。 | 
| LAST\$1PERIOD\$1MISSING\$1AUDIO | AdaptationSets由于原始音频或视频未对齐，DASH 清单中的最后一段缺少所有音频。为避免播放问题，请至少延迟发布最后一段时间，直到下一个请求为止。 | 
| LAST\$1PERIOD\$1MISSING\$1AUDIO\$1WARNING | AdaptationSets由于原始音频或视频未对齐，DASH 清单中的最后一段缺少所有音频。选择发布（而不是延迟）最后一个时段。缺少音频可能会导致播放问题。 | 
| MANIFEST\$1ERROR |  MediaTailor 清单请求失败。 | 
| NO\$1MASTER\$1OR\$1MEDIA\$1PLAYLIST | Origin 响应不包含主播放列表或媒体播放列表。 | 
| NO\$1MASTER\$1PLAYLIST | Origin 响应不包含预期的主播放列表。 | 
| NO\$1MEDIA\$1PLAYLIST | Origin 响应不包含预期的媒体播放列表。 | 
| ORIGIN\$1MANIFEST | MediaTailor 已获取来源清单。必须启用调试模式才能接收这些日志。有关调试日志模式的信息，包括如何启用该模式，请参阅[生成调试日志](debug-log-mode.md)。 | 
| PARSING\$1ERROR | 来源无法解析清单请求。 | 
| SCTE35\$1PARSING\$1ERROR | MediaTailor 无法解析清单中的Signal Binary元素。 | 
| SESSION\$1INITIALIZED | 会话已初始化。必须启用调试模式才能接收这些日志。有关调试日志模式的信息，包括如何启用该模式，请参阅[生成调试日志](debug-log-mode.md)。 | 
| TIMEOUT\$1ERROR |  MediaTailor 清单请求超时。 | 
| TRACKING\$1RESPONSE | MediaTailor 发出了追踪回复。必须启用调试模式才能接收这些日志。有关调试日志模式的信息，包括如何启用该模式，请参阅[生成调试日志](debug-log-mode.md)。 | 
| UNKNOWN\$1ERROR | MediaTailor 遇到了未知错误。 | 
| UNKNOWN\$1HOST | 主机未知。 | 
| UNSUPPORTED\$1SINGLE\$1PERIOD\$1DASH\$1MANIFEST | 不支持单周期 DASH 清单。 MediaTailor 正在通过单期 DASH 清单。 | 

## 清单日志属性
<a name="manifest-logs-main"></a>

本节介绍清单日志的属性。


| 属性 | Type | 必需 | 
| --- | --- | --- | 
| awsAccountId | 字符串 | true | 
| eventTimestamp | 字符串 | true | 
| originId | 字符串 | true | 
| customerId | 字符串 | false | 
| eventType | 字符串 | false | 
| sessionId | 字符串 | false | 
| originRequestUrl | 字符串 | false | 
| mediaTailorPath | 字符串 | false | 
| requestId | 字符串 | false | 
| responseBody | 字符串 | false | 
| sessionType | 字符串（合法值：[DASH, HLS]） | false | 
| requestNextToken | 字符串 | false | 
| eventDescription | 字符串 | false | 
| assetPath | 字符串 | false | 
| originFullUrl | 字符串 | false | 
| originPrefixUrl | 字符串 | false | 
| additionalInfo | 字符串 | false | 
| cause | 字符串 | false | 
| response | 字符串 | false | 
| httpCode | 字符串 | false | 
| errorMessage | 字符串 | false | 
| adAdsResponse | 字符串 | false | 
| adAdsRawResponse | 字符串 | false | 
| adAdsRequest | 字符串 | false | 
| adNumNewAvails | 字符串 | false | 
| generatedMediaPlaylist | 字符串 | false | 
| requestStartTime | 字符串 | false | 
| requestEndTime | 字符串 | false | 
| requestStartTimeEpochMillis | 字符串 | false | 
| requestEndTimeEpochMillis | 字符串 | false | 

# AWS Elemental MediaTailor 转码日志、描述和事件类型
<a name="tm-log-format"></a>

以下各节描述了在为广告拼接准备广告素材时为描述转码服务的事件而 MediaTailor 发出的日志。这些是`TranscodeService`日志。

**Topics**
+ [TranscodeService 事件](#log-types-tminteraction)
+ [转码日志属性](#transcode-logs-main)

## TranscodeService 事件
<a name="log-types-tminteraction"></a>

在对广告进行转码时， MediaTailor 互动期间会发出以下事件。


| Log | 说明 | 
| --- | --- | 
| IMPORT\$1ERROR | MediaTailor 在导入任务期间遇到内部错误（适用于预处理广告）。使用一组空的广告。 | 
| INITIALIZED | MediaTailor 已初始化转码任务或导入任务（适用于预处理广告）。 | 
| INTERNAL\$1ERROR | MediaTailor 遇到了内部错误。使用一组空的广告。 | 
| MISSING\$1VARIANTS | MediaTailor 由于缺少变体，无法对广告进行转码。使用一组空的广告。 | 
| PROFILE\$1NOT\$1FOUND | MediaTailor 由于缺少要转码的配置文件，因此无法对广告进行转码。使用一组空的广告。 | 
| TRANSCODE\$1COMPLETED | 视频转码已完成。该广告可用于广告插播。 | 
| TRANSCODE\$1ERROR | MediaTailor 在执行转码作业时遇到内部错误。使用一组空的广告。 | 
| TRANSCODE\$1IN\$1PROGRESS | 视频转码正在进行中。转码后的视频尚未准备就绪。使用一组空的广告。 | 

## 转码日志属性
<a name="transcode-logs-main"></a>

本节介绍转码日志的属性。


| 属性 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
| awsAccountId | 字符串 | true | 用于会话的 MediaTailor 配置的 AWS 帐户 ID。 | 
| eventTimestamp | 字符串 | true | 事件的日期和时间。 | 
| originId | 字符串 | true | 配置中的 MediaTailor 配置名称。这与视频内容源不同，它也是配置的一部分。 | 
| eventType | 字符串 | false | 已触发此日志消息的事件的代码。示例：TRANSCODE\$1ERROR。 | 
| eventDescription | 字符串 | false |  MediaTailor 服务提供的对触发此日志消息的事件的简短描述。默认情况下，这为空。 | 
| sessionId | 字符串 | false |  MediaTailor 分配给玩家会话的唯一数字标识符。玩家为会话提出的所有请求都具有相同的会话 ID。示例：e039fd39-09f0-46b2-aca9-9871cc116cde。 | 
| creativeUniqueId | 字符串 | false | 正在转码的广告素材的唯一标识符。 | 
| profileName | 字符串 | false |  | 
| adUri | 字符串 | false | 广告素材的 URI。 | 
| transcodeRequestId | 字符串 | false | 此转码请求的唯一标识符。 | 
| cacheStatus | 字符串 | false | 表示是否 MediaTailor 缓存了转码后的广告。 | 

# 使用已售日志发送 AWS Elemental MediaTailor 日志
<a name="vended-logs"></a>

您可以使用vended logs来提高灵活性，并可以控制将从播放配置中 MediaTailor 发出的日志传送到何处。

使用已出售的日志， MediaTailor 将与配置相关的所有日志活动发送到 Amazon Lo CloudWatch gs。 CloudWatch 然后，Logs 会将您指定的日志百分比发送到您选择的目的地。支持的目标包括亚马逊 CloudWatch 日志组、亚马逊 S3 存储桶或 Amazon Data Firehose 流。

由于销售日志以批量折扣（bolume discount）的价格提供，因此与直接将日志发送到日志相比， CloudWatch 您可以节省成本。有关定价，请参阅 [Amazon CloudWatch ](https://aws.amazon.com/cloudwatch/pricing/) P *ricing 中 “日**志**” 选项卡上的 “销售*日志”。

要使用已出售的日志，您必须执行以下操作：

1. [添加权限](#vended-logs-perms).

1. [创建日志传送目标](#vended-logs-destinations).

1. [在日志中配置 CloudWatch 日志传输](#vended-logs-delivery).

1. [启用 vended 登录 MediaTailor](#vended-logs-config).

有关已售日志的更多信息，请参阅《日志》用户指南中的[启用 AWS 服务 CloudWatch 日志记录](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)。 MediaTailor 支持 V2 的已售日志。

## 步骤 1：添加 MediaTailor 日志传输权限
<a name="vended-logs-perms"></a>

设置销售日志的人员必须具有创建传送目标、配置日志传输和启用公开登录的权限。 MediaTailor使用以下策略来确保您拥有设置公开日志的相应权限。

** CloudWatch 日志和传送目的地政策**  
*Amazon CloudWatch Logs 用户指南*中的以下部分提供了允许您使用日志中的 CloudWatch 日志和您的送货目的地的策略。如果您将日志发送到多个位置，则可以将策略声明合并为一个策略，而不必创建多个策略。  
+ [发送到日志的 CloudWatch 日志](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-V2-CloudWatchLogs)
+ [发送到 Amazon S3 的日志](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-V2-S3)
+ [已发送到 Firehose 的日志](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-V2-Firehose)

**从控制台进行设置的策略**  
如果您要通过控制台而不是 API 或设置销售日志传输 AWS CLI，则您的策略中必须具有以下额外权限。

**对外登录的政策 MediaTailor**  
要在中创建、查看或修改交付的公开日志 MediaTailor，您的策略中必须具有以下权限。

有关添加权限和使用策略的信息，请参阅[适用于 Identity and Access Managem AWS Elemental MediaTailor](security-iam.md)。

## 步骤 2：为 MediaTailor 日志创建传送目的地
<a name="vended-logs-destinations"></a>

创建将发送日志的资源。记录资源的 ARN，以便在以后的步骤中配置日志传送时使用。

**CloudWatch 日志日志组传送目标**  
使用以下方法之一来帮助创建日志组。  
+ 有关控制台，请参阅 *Amazon CloudWatch 日志用户指南中的日志中的创建 CloudWatch 日志*[组](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#Create-Log-Group)。
+ 有关 API，请参阅[CreateLogGroup](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html)《*亚马逊 CloudWatch 日志 API 参考》。*
+ 有关 SDKs 和 CLI，请参阅与 [AWS SDK `CreateLogGroup` 配合使用或](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/example_cloudwatch-logs_CreateLogGroup_section.html) *Amazon L CloudWatch ogs 用户指南 AWS CLI*中的内容。

**亚马逊 S3 存储桶交付目的地**  
使用以下方法之一来帮助创建存储桶。  
+ 有关控制台 SDKs、和 CLI，请参阅 *Amazon 简单存储服务用户指南中的创建存储*[桶](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html)。
+ 有关 API，请参阅[CreateBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html)《*亚马逊简单存储服务 API 参考*》。

**Firehose 直播传输目的地**  
有关创建直播的帮助，请参阅《*亚马逊数据 Firehose 开发者指南》中的从控制台创建 Firehose* [直](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html)播。

## 第 3 步：为 MediaTailor 播放配置启用已售日志
<a name="vended-logs-config"></a>

创建或更新播放配置，该配置将向您在上一步中创建的传送目标发送日志。记录配置名称，以便在以后的步骤中配置日志传送时使用。
+ 要通过控制台启用销售日志，请使用[创建配置](configurations-create.md)或[编辑配置设置](configurations-edit.md)编辑配置来访问**日志**设置。对于**日志策略**，请选择 **Vended 日志。**
+ 要通过 API 启用销售日志，您必须具有现有配置。`ConfigureLogsForPlaybackConfiguration`用于添加日志策略`Vended logs`。

如果您使用的是将日志直接发送到 CloudWatch 日志的传统日志 MediaTailor 记录策略，并且想要迁移到销售日志，请参阅[迁移日志策略](vended-logs-migrate.md)。

**重要**  
 如果您将日志策略从 Legacy 更改 CloudWatch 为已售日志，则 MediaTailor 将在保存更新后立即进行此更改。在完全配置 vended 日志之前，您将停止接收日志。

## 步骤 4：在日志中 CloudWatch 配置日志传输
<a name="vended-logs-delivery"></a>

在 CloudWatch Logs 中，必须创建三个元素来表示日志传送的各个部分。这些元素在《*亚马逊 CloudWatch 日志 API 参考*》[CreateDelivery](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html)中有详细描述。使用 CloudWatch 日志 API 配置交付的高级步骤如下。

**在日志 (API) 中配置 CloudWatch 日志传输**

1. [https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html)用于添加日志来源。

   A `DeliverySource` 表示生成日志的播放配置。您需要播放配置的名称才能创建`DeliverySource`。

1. 用于[https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html)添加写入日志的目标。

   A `DeliveryDestination` 代表配送目的地。您需要日志组、存储桶或流的 ARN 才能创建。`DeliveryDestination`

1. [https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html)如果您要跨账户传送日志，请使用。

   如果配送目的地的账户与播放配置不同，则需要`DeliveryDestinationPolicy`。此策略允许 CloudWatch 日志将日志传送到`DeliveryDestination`。

1. 用于[https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html)将链接`DeliverySource`到`DeliveryDestination`。

   A `Delivery` 表示`DeliverySource`和之间的连接`DeliveryDestination`。

# 迁移您的 AWS Elemental MediaTailor 日志策略
<a name="vended-logs-migrate"></a>

 如果您将日志策略从 Legacy 更改 CloudWatch 为已售日志，则 MediaTailor 将在保存更新后立即进行此更改。为避免日志记录工作流程中断，请使用以下步骤迁移您的日志策略。

1. 请按照 [使用已售日志](vended-logs.md) 中所述的步骤操作。对于[启用 vended 登录 MediaTailor](vended-logs.md#vended-logs-config)，选择*两种*日志记录策略（**Vended 日志**和**旧**日志 CloudWatch）。

   MediaTailor 将通过两个已售日志发送日志，并直接发送到 CloudWatch 日志。

1. 根据您的日志策略和交付目的地，对工作流程进行必要的更改。

1. 重新访问[启用 vended 登录 MediaTailor](vended-logs.md#vended-logs-config)并 CloudWatch从**日志策略**中删除 **Legacy**。

# 将 AWS Elemental MediaTailor 日志直接写入 Amazon CloudWatch 日志
<a name="monitoring-cw-logs"></a>

MediaTailor 生成包含会话活动和广告决策服务器交互详细信息的日志，并将其写入 Amazon CloudWatch。这些日志按顺序描述了会话期间发生的活动。

MediaTailor 还可以使用已售日志，以灵活地交付日志和批量 discount 定价。有关已售日志的信息，请参阅[使用已售日志](vended-logs.md)。

**Topics**
+ [Amazon CloudWatch 日志的权限](monitoring-permissions.md)
+ [AWS Elemental MediaTailor 频道组装的 “As Run” 日志](as-run-log.md)
+ [AWS Elemental MediaTailor Amazon 日志见解中的 ADS CloudWatch 日志分析](monitor-cloudwatch-ads-logs.md)

# Amazon CloudWatch 日志的权限
<a name="monitoring-permissions"></a>

使用 AWS Identity and Access Management (IAM) 创建授予亚马逊 AWS Elemental MediaTailor 访问权限的角色 CloudWatch。您必须执行以下步骤才能为您的账户发布 CloudWatch 日志。 CloudWatch 自动发布您账户的指标。

**允许 MediaTailor 访问 CloudWatch**

1. 使用 [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/) 打开 IAM 控制台。

1. 在 IAM 控制台的导航窗格中，选择**角色**，然后选择**创建角色**。

1. 选择**其他 AWS 账户**角色类型。

1. 在**账户 ID** 中，输入您的 AWS 账户 ID。

1. 选择 **Require external ID (需要外部 ID)** 并输入 **Midas**。此选项会在信任策略中自动添加一个条件，即仅当请求包含正确的 `sts:ExternalId` 时，该服务才代入该角色。

1. 选择**下一步: 权限**。

1. 添加指定此角色可完成的操作的权限策略。从以下选项中选择一项，然后选择 **Next: Review (下一步: 审核)**：
   + **CloudWatchLogsFullAccess**提供对 Amazon CloudWatch 日志的完全访问权限
   + **CloudWatchFullAccess**提供对 Amazon 的完全访问权限 CloudWatch

1. 对于**角色名称**，输入 **MediaTailorLogger**，然后选择**创建角色**。

1. 在 **Roles (角色)** 页面上，选择您刚刚创建的角色。

1. 要更新委托人，请编辑信任关系：

   1. 在角色的 **Summary (摘要)** 页上，选择 **Trust relationship (信任关系)** 选项卡。

   1. 选择**编辑信任关系**。

   1. 在策略文档中，将委托人更改为 MediaTailor 服务。它应如下所示：

      ```
      "Principal": {
         "Service": "mediatailor.amazonaws.com"
      },
      ```

      整个策略的内容现在应如下所示：

   1. 选择**更新信任策略**。

# AWS Elemental MediaTailor 频道组装的 “As Run” 日志
<a name="as-run-log"></a>

日志组中的 A *s Run* CloudWatch `MediaTailor/Channel/AsRunLog` 日志在播放时显示有关节目和广告时段的信息。

创建频道时，默认情况下，As Run 日志处于禁用状态。使用控制台或 AWS Command Line Interface (AWS CLI)，您可以为账户中的每个频道启用和禁用 As Run 日志状态。

启用 As Run 日志后， MediaTailor 会自动创建一个服务相关角色， MediaTailor 允许在您的日志账户中写入和管理 As Run CloudWatch 日志。有关服务关联角色的更多信息，请参阅[将服务相关角色用于 MediaTailor](using-service-linked-roles.md)。

**注意**  
As Run Log 目前仅支持默认程序。目前，它不支持由程序规则创建的 AlternateMedia。这意味着它目前不为 AlternateMedia 生成 As Run 日志。

**Topics**
+ [启用 As Run 日志](enabling-as-run-log.md)
+ [禁用 As Run 日志](disabling-as-run-log.md)

# 启用 As Run 日志
<a name="enabling-as-run-log"></a>

要启用 As Run 日志，请指定频道名称并为该频道启用 A *s Run* 日志类型。

------
#### [ Console ]

**在创建频道时启用 As Run 日志**

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在导航窗格中，选择**频道集合** > **频道**。

1. 在导航栏上，选择**创建频道**。

1. 在 “**设置频道详细信息**”、**“配置输出**” 和 “**访问控制**” 窗格中，根据需要配置您的频道。

1. 在 “**访问控制**” 窗格中，选择 “**下一步**”。

1. 在 “**日志记录**” 窗格的 “**日志类型**” 下，选择 “**启用为运行**” 以启用 As Run 日志。

**在更新频道时启用 As Run 日志**
**注意**  
如果该频道当前正在运行，则必须先停止该频道，然后才能对其进行更新。停止频道后，您可以选择 “**操作****” > “编辑”** 开始更新频道。

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在导航窗格中，选择**频道集合** > **频道**。

1. 选择要更新的频道以启用 As Run 日志。

1. 选择**操作** > **编辑**。

1. 在 “**设置频道详情**”、**“配置输出**” 和 “**访问控制**” 窗格中，根据需要更新频道配置。

1. 在 “**访问控制**” 窗格中，选择 “**下一步**”。

1. 在 “**日志记录**” 窗格的 “**日志类型**” 下，选择 “**启用为运行**” 以启用 As Run 日志。

**从 “**记录**” 选项卡中启用 As Run 日志**
**注意**  
如果频道当前正在运行，则必须使用 “**记录**” 选项卡，而不是选择 “**操作**” > “**编辑**” 来启用 As Run 日志。

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在导航窗格中，选择**频道集合** > **频道**。

1. 选择要为其启用 As Run 日志的频道。

1. 在频道名称下方的导航栏中，选择 Lo **gging**。

1. **在 “日志” > “**日志类型**” 下，选择 “**当运行**” 以启用 As Run 日志。**

------
#### [ AWS Command Line Interface (AWS CLI) ]

**启用 As Run 日志**

运行[configure-logs-for-channel](https://docs.aws.amazon.com/cli/latest/reference/mediatailor/configure-logs-for-channel.html)命令并为所需参数指定适当的值。

此示例是针对 Linux、macOS 或 Unix 进行格式化的，它使用反斜杠（\$1）行继续符来提高可读性。

```
$ aws mediatailor configure-logs-for-channel \
--channel-name MyChannel \
--log-types AS_RUN
```

此示例是针对 Microsoft Windows 进行格式化的，它使用尖号 (^) 行继续符来提高可读性。

```
C:\> aws mediatailor configure-logs-for-channel ^
--channel-name MyChannel ^
--log-types AS_RUN
```

其中：
+ `MyChannel`是您拥有并要为其启用 As Run 日志的频道的名称。

如果命令成功运行，则您将收到类似于以下内容的输出：

```
{
    "ChannelName": "MyChannel",
    "LogTypes": [
       "AS_RUN"
    ]
}
```

------

# 禁用 As Run 日志
<a name="disabling-as-run-log"></a>

要为启用了 As Run 日志的频道禁用 As Run 日志，请指定频道名称并禁用该频道的 A *s Run* 日志类型。

------
#### [ Console ]

**在更新频道时禁用 As Run 日志**
**注意**  
如果该频道当前正在运行，则必须先停止该频道，然后才能对其进行更新。停止频道后，您可以选择 “**操作****” > “编辑”** 开始更新频道。

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在导航窗格中，选择**频道集合** > **频道**。

1. 选择要更新的频道以启用 As Run 日志。

1. 选择**操作** > **编辑**。

1. 在 “**设置频道详情**”、**“配置输出**” 和 “**访问控制**” 窗格中，根据需要更新频道配置。

1. 在 “**访问控制**” 窗格中，选择 “**下一步**”。

1. 在 “**日志记录**” 窗格的 “**日志类型**” 下，清除 “**启用为运行**” 以禁用 As Run 日志。

**从 “**记录**” 选项卡中禁用 As Run 日志**
**注意**  
如果频道当前正在运行，则必须使用 “**记录**” 选项卡，而不是选择 “**操作**” > “**编辑**” 来禁用 As Run 日志。

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在导航窗格中，选择**频道集合** > **频道**。

1. 选择要禁用 As Run 日志的频道。

1. 在频道名称下方的导航栏中，选择 Lo **gging**。

1. **在 “日志” > “**日志类型**” 下，清除 **As run** 以禁用 As Run 日志。**

------
#### [ AWS Command Line Interface (AWS CLI) ]

**禁用 As Run 日志**

运行[configure-logs-for-channel](https://docs.aws.amazon.com/cli/latest/reference/mediatailor/configure-logs-for-channel.html)命令并为所需参数指定适当的值。

此示例是针对 Linux、macOS 或 Unix 进行格式化的，它使用反斜杠（\$1）行继续符来提高可读性。

```
$ aws mediatailor configure-logs-for-channel \
--channel-name MyChannel \
--log-types
```

此示例是针对 Microsoft Windows 进行格式化的，它使用尖号 (^) 行继续符来提高可读性。

```
C:\> aws mediatailor configure-logs-for-channel ^
--channel-name MyChannel ^
--log-types
```

其中：
+ `MyChannel`是您拥有并要禁用 As Run 日志的频道的名称。

如果命令成功运行，则您将收到类似于以下内容的输出：

```
{
    "ChannelName": "MyChannel",
    "LogTypes": []
}
```

------

# AWS Elemental MediaTailor Amazon 日志见解中的 ADS CloudWatch 日志分析
<a name="monitor-cloudwatch-ads-logs"></a>

您可以使用 Amazon Logs Insights 查看和查询 AWS Elemental MediaTailor 广告决策服务器 (ADS) CloudWatch 日志。 MediaTailor 将事件日志发送到， CloudWatch 用于正常处理和错误情况。日志遵循 JSON 架构。通过 CloudWatch Logs Insights，您可以按时间范围选择日志，然后对其进行查询。

有关一般信息，请参阅[使用日志见解分析 CloudWatch 日志数据](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html)。

**注意**  
要访问日志，您需要访问Amazon的权限 CloudWatch。有关说明，请参阅[Amazon CloudWatch 日志的权限](monitoring-permissions.md)。

**使用 CloudWatch 控制台查看和查询 ADS 日志**

1. 打开 CloudWatch 控制台，网址为[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)。

1. 在导航窗格中的 **Logs (日志)** 下，选择 **Insights (见解)**。

1. 在搜索栏中输入**AdDec**，然后从下拉列表中选择`MediaTailor/AdDecisionServerInteractions`。

1. （可选）调整要研究的时间段。

1. （可选）更改对话框中的查询。有关一般指导，请参阅[CloudWatch 日志见解查询语法](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)。有关 MediaTailor ADS 的查询的示例，请参阅 [查询 ADS 日志](querying-the-ads-logs.md)。

1. 选择**运行查询**。该查询可能需要几秒钟时间，在此期间，将显示 **Cancel (取消)** 来代替 **Run query (运行查询)**。

1. （可选）要将结果导出为 CSV 文件，请选择 **Actions (操作)**，然后选择 **Download query results (CSV) (下载查询结果(CSV))**。

**注意**  
控制台限制了它在查询结果中返回和导出的记录数量，因此对于批量数据，请使用 API、 AWS Command Line Interface (AWS CLI) 或 SDK。

**Topics**
+ [查询 ADS 日志](querying-the-ads-logs.md)

# 查询 ADS 日志
<a name="querying-the-ads-logs"></a>

CloudWatch Logs Insights 提供了一组丰富的查询日志的选项。有关查询语法的详细信息，请参阅[CloudWatch 日志见解查询语法](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)。此部分提供了一些常见查询示例来帮助您开始使用 ADS 日志查询。所有查询都针对当前时间范围设置的日志运行。

以下查询从 ADS 日志中检索所有信息。

```
fields @timestamp, eventType, sessionId, requestId, @message
| sort sessionId, @timestamp asc
```

以下查询检索对 ADS 的所有请求。此查询显示了一种检索 MediaTailor 日志请求标头内容的方法。

```
fields @timestamp, adsRequestUrl, requestHeaders.0.value as @userAgent, requestHeaders.1.value as @xForwardedFor, sessionId, requestId
| filter eventType = "MAKING_ADS_REQUEST"
| sort @timestamp asc
```

以下查询检索为给定会话 MediaTailor 插入的广告。

```
fields @timestamp, sessionId, requestId, @message
| filter eventType = "FILLED_AVAIL"
| sort @timestamp asc
```

以下查询检索代表玩家 MediaTailor 调 URLs 用的跟踪。

```
fields @timestamp, beaconInfo.trackingEvent, beaconInfo.beaconUri, beaconInfo.headers.0.value as @userAgent, beaconInfo.headers.1.value as @xForwardedFor, sessionId, requestId
| filter eventType = "BEACON_FIRED"
| sort @timestamp asc
```

以下查询通过按 `sessionId` 筛选结果来检索特定播放会话的信息。

```
fields @timestamp, eventType, sessionId, requestId, @message
| filter sessionId = "0aaf6507-c6f9-4884-bfe7-f2f841cb8195"
| sort @timestamp asc
```

以下查询通过按 `requestId` 筛选结果来检索单个请求的信息。

```
fields @timestamp, eventType, sessionId, requestId, @message
| filter requestId = "f5d3cf39-6258-4cf1-b3f6-a34ff8bf641d"
| sort @timestamp asc
```

以下查询检索记录的每种事件类型的日志条目计数。

```
fields eventType
| stats count() as @eventCount by eventType
```

以下查询检索已跳过广告的所有效用的效用 ID 和已跳过广告列表。

```
fields avail.availId
| parse @message '"skippedAds":[*]' as @skippedAdsList
| filter ispresent(@skippedAdsList)
```

# 控制 AWS Elemental MediaTailor 日志量
<a name="log-configuration"></a>

MediaTailor 广告插入会话日志有时很冗长。为了降低日志成本，您可以定义 MediaTailor 发送到 Amazon Logs 的会话 CloudWatch 日志的百分比。例如，如果您的播放配置有 1000 个广告插入会话，并且您将启用百分比的值设置为`60`，则会将其中 600 个会话的日志 MediaTailor 发送到 CloudWatch 日志。 MediaTailor 随机决定向哪个会话发送日志。如果要查看特定会话的日志，则可以使用[调试日志模式](debug-log-mode.md)。

设置日志百分比时， MediaTailor 会自动创建一个服务相关角色，该角色授予 MediaTailor 向您的账户写入 CloudWatch 日志所需的权限。有关如何 MediaTailor 使用服务相关角色的信息，请参阅[将服务相关角色用于 MediaTailor](using-service-linked-roles.md)。

## 创建日志配置
<a name="creating-log-configuration"></a>

要控制 MediaTailor 写入日志的会话 CloudWatch 日志的百分比，您需要为播放*配置创建日志*配置。创建日志配置时，需要指定*播放配置名称*和*启用百分比*值。

------
#### [ Console ]

**为*现有*播放配置创建日志配置**

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在**播放配置**窗格上，选择要为其设置日志配置的播放配置。

1. 选择**编辑**。

1. 在 “**日志配置**” 下，指定**启用百分比**值。

**为*新的*播放配置创建日志配置**
+ 按照[日志配置](configurations-create.md#configurations-log-configurations)中的程序操作。

------
#### [ AWS Command Line Interface (AWS CLI) ]

**为*现有*播放配置创建日志配置**

要使用创建日志配置 AWS CLI，请运行 [configure-logs-for-playback-configur](https://docs.aws.amazon.com/cli/latest/reference/mediatailor/configure-logs-for-playback-configuration.html) ation命令并为所需参数指定适当的值。

此示例是针对 Linux、macOS 或 Unix 进行格式化的，它使用反斜杠（\$1）行继续符来提高可读性。

```
$ aws mediatailor configure-logs-for-playback-configuration \
--percent-enabled 10 \
--playback-configuration-name MyPlaybackConfiguration
```

此示例是针对 Microsoft Windows 进行格式化的，它使用尖号 (^) 行继续符来提高可读性。

```
C:\> aws mediatailor configure-logs-for-playback-configuration ^
--percent-enabled 10 ^
--playback-configuration-name MyPlaybackConfiguration
```

其中：
+ `percent-enabled`是 MediaTailor发送到 “日志” 的播放配置会话 CloudWatch 日志的百分比。
+ `playback-configuration-name`是要为其设置日志配置设置的播放配置的名称。

如果命令成功运行，则您将收到类似于以下内容的输出：

```
{
    "PercentEnabled": 10,
    "PlaybackConfigurationName": "MyPlaybackConfiguration"
}
```

**为*新的*播放配置创建日志配置**
+ 使用[put-playback-configuration](https://docs.aws.amazon.com/cli/latest/reference/mediatailor/put-playback-configuration.html)命令的`configure-logs-for-playback-configuration`选项。

------

## 停用日志配置
<a name="deactivating-logging-configuration"></a>

创建日志配置后，您无法将其删除，只能将其*停*用。要停用日志配置，请使用 MediaTailor 控制台或 API 将**启用百分比**值设置**为 0**。这将关闭该播放配置的所有会话记录。

如果要删除账户中 MediaTailor 用于日志配置的服务相关角色，则必须先停用所有日志配置。有关如何删除服务相关角色的信息，请参阅[将服务相关角色用于 MediaTailor](using-service-linked-roles.md)。

------
#### [ Console ]

**停用播放配置的日志配置**

1. 登录 AWS 管理控制台 并打开 MediaTailor 控制台，网址为[https://console.aws.amazon.com/mediatailor/](https://console.aws.amazon.com/mediatailor/)。

1. 在**播放配置**窗格上，选择要停用日志配置的播放配置。

1. 选择**编辑**。

1. 在 “**日志配置”** 下，将**启用百分比**值设置为`0`。这将关闭此播放配置的所有会话记录。

1. 选择**保存**。

------
#### [ AWS Command Line Interface (AWS CLI) ]

**停用日志配置**
+ `0`使用 [configure-logs-for-playback-](https://docs.aws.amazon.com/cli/latest/reference/mediatailor/configure-logs-for-playback-configuration.html) configuration 命令将该`percent-enabled`值设置为。

------

# 筛选 AWS Elemental MediaTailor 日志和事件
<a name="logs-filter"></a>

中播放配置发出的日志 MediaTailor 包括有关播放会话期间发生的各种活动的信息。这些活动在日志的事件类型中标识。默认情况下，会记录许多事件。为了帮助控制 Amazon 中日志的成本 CloudWatch，您可以指定 MediaTailor 发出的日志。

MediaTailor 允许您控制日志过滤，因此您可以执行以下操作：
+ 指定要从日志中排除的日志事件
+ 启用记录来自广告决策服务器 (ADS) 的原始响应

您可以为每个播放会话单独设置这些日志过滤首选项，也可以将这些首选项设置为播放配置的所有播放会话的默认设置。
+ 要按会话筛选日志，请在播放会话初始化请求中包含查询参数。
+ 要按播放配置筛选日志，请使用 MediaTailor 控制台或 API 在播放配置设置中指明您的偏好。

以下各节提供有关在会话和播放配置上启用日志筛选的说明。

# 每会话日志过滤器
<a name="logs-filter-session"></a>

要为每个会话定义自定义的日志详细信息级别，请在服务器端或客户端的初始播放会话请求中附加以下参数。以逗号分隔的格式向参数添加值以表示要包含或排除的事件：
+ `aws.adsInteractionLogPublishOptInEventTypes`接收特定广告决策服务器 (ADS) 互动的日志。
+ `aws.adsInteractionLogExcludeEventTypes`停止接收特定 ADS 互动的日志。
+ `aws.manifestServiceLogExcludeEventTypes`停止接收特定清单服务交互的日志。

有关发 MediaTailor 出的日志和事件类型的列表，请参阅[清单日志](log-types.md)[广告日志](ads-log-format.md)、和。[对日志进行转码](tm-log-format.md)

如果您没有传递任何用于日志筛选的查询参数，则 MediaTailor 会将所有日志写入您的传送目的地。

**Example 使用日志过滤器初始化服务器端会话**  
要从清单日志`GENERATED_MANIFEST`和 ADS 日志`MAKING_ADS_REQUEST`中排除`PARSING_ERROR`事件，会话初始化请求将如下所示：  

```
GET <mediatailorURL>/v1/master/<hashed-account-id>/<origin-id>/index.m3u8?aws.logMode=DEBUG&aws.manifestServiceLogExcludeEventTypes=GENERATED_MANIFEST,PARSING_ERROR&aws.adsInteractionLogExcludeEventTypes=MAKING_ADS_REQUEST
```
要启用来自您的 ADS 的原始日志，请包括以下`AdsInteractionPublishOptInEventType`参数的`RAW_ADS_RESPONSE`值：  

```
GET <mediatailorURL>/v1/master/<hashed-account-id>/<origin-id>/index.m3u8?aws.adsInteractionPublishOptInEventType=RAW_ADS_RESPONSE
```

**Example 使用日志过滤器初始化客户端会话**  
要在客户端会话初始化期间排除日志事件，请在客户端的 POST 请求中包含`availSuppression`和日志类型参数。 MediaTailor有关如何构建客户端播放会话请求的更多信息，请参阅[客户端广告跟踪](ad-reporting-client-side.md)。以下示例从清单日志`CONFIG_SECURITY_ERROR`和 ADS 日志`MAKING_ADS_REQUEST`中排除`PARSING_ERROR`事件。  

```
POST parent.m3u8
   {
       "adsInteractionLog": {
           ...
           "excludeEventTypes": [
               "MAKING_ADS_REQUEST"
           ]
       },
       "manifestServiceLog": {
           ...
           "excludeEventTypes": [
               "GENERATED_MANIFEST",
               "PARSING_ERROR"
           ]
       },
      "logMode": "DEBUG"
   }
```
 要启用来自您的 ADS 的原始日志，请包括以下`publishOptInEventTypes`参数的`RAW_ADS_RESPONSE `值：  

```
POST parent.m3u8
   {
       "adsInteractionLog": {
           "publishOptInEventTypes": ["RAW_ADS_RESPONSE"],
           "excludeEventTypes": [
               "MAKING_ADS_REQUEST"
           ]
       },
       "manifestServiceLog": {
           ...
           "excludeEventTypes": [
               "GENERATED_MANIFEST",
               "PARSING_ERROR"
           ]
       },
       "logMode": "DEBUG"
   }
```

# 每次播放配置日志过滤器
<a name="logs-filter-config"></a>

使用播放配置的设置来定义该播放配置中默认 MediaTailor 发出的日志事件类型。 MediaTailor 对会话初始化请求中不包含筛选查询参数的所有会话使用这些默认的日志过滤设置。

您可以选择执行以下操作：
+ 接收特定广告决策服务器 (ADS) 互动的日志。
+ 排除特定 ADS 互动的日志。
+ 排除特定清单服务交互的日志。

要从 MediaTailor 控制台设置这些设置，请参阅[创建配置](configurations-create.md)。有关 MediaTailor API 的信息，请参阅 *AWS Elemental MediaTailor API 参考[https://docs.aws.amazon.com/mediatailor/latest/apireference/API_PutPlaybackConfiguration.html](https://docs.aws.amazon.com/mediatailor/latest/apireference/API_PutPlaybackConfiguration.html)*中的。

有关发 MediaTailor 出的日志和事件类型的列表，请参阅[清单日志](log-types.md)[广告日志](ads-log-format.md)、和。[对日志进行转码](tm-log-format.md)

# 生成 AWS Elemental MediaTailor 调试日志
<a name="debug-log-mode"></a>

使用调试日志来解决 MediaTailor 广告插入播放会话问题。要生成调试日志，请在玩家的请求中将日志模式设置为调试 MediaTailor。要进行服务器端报告，请在*播放请求*中设置日志模式。对于客户端报告，请在*会话初始化请求*中设置日志模式。

当日志模式设置为调试时， MediaTailor 会将所有日志事件类型写入 CloudWatch 日志。日志提供有关以下事件的信息。有关调试日志中生成的数据的完整列表，请参阅调[试日志字段](https://docs.aws.amazon.com/mediatailor/latest/ug/debug-log-mode.html#debug-log-mode-fields)。
+ **源交互**-有关与源服务器 MediaTailor 交互的详细信息。例如，来源清单响应、清单类型和来源 URL。
+ **生成的清单**-有关来自的播放会话响应的详细信息 MediaTailor。例如，生 MediaTailor 成的清单。
+ **会话已初始化**-会话初始化详细信息，例如会话 ID。

要自定义按会话接收的日志事件类型，请参阅[筛选日志和事件](logs-filter.md)。

## 先决条件
<a name="prerequisites"></a>

要将日志模式设置为调试，首先需要授予向其发送日志的 MediaTailor 权限（如果还没有）。 CloudWatch授予 MediaTailor 访问权限后 CloudWatch，就可以启用调试日志模式了。有关如何授予访问 MediaTailor 权限的信息， CloudWatch 请参阅[为 Amazon 设置权限 CloudWatch](https://docs.aws.amazon.com/mediatailor/latest/ug/monitoring-permissions.html)。

## 如何将日志模式设置为调试
<a name="how-to-turn-on-debug-log-mode"></a>

本节介绍如何将服务器端报告和客户端报告的日志模式设置为调试。

### 服务器端报告
<a name="server-side-reporting"></a>

要进行服务器端报告，请在玩家向 HLS 或 DASH MediaTailor 端点发`GET HTTP`出的播放请求中包含`?aws.logMode=DEBUG`查询参数和值。有关服务器端报告的一般信息，请参阅[服务器端](https://docs.aws.amazon.com/mediatailor/latest/ug/ad-reporting-server-side.html)报告。

**重要**  
`DEBUG` 值区分大小写。

 包含以下内容的播放请求`?aws.logMode=DEBUG`如下所示：

**Example 向 HLS 端点发送的播放请求**  

```
GET <mediatailorURL>/v1/master/<hashed-account-id>/<origin-id>/<asset-id>?aws.logMode=DEBUG
```
将日志模式设置为调试后，我们建议您验证调试日志会话是否处于活动状态。要验证调试会话是否处于活动状态，请检查是否有该会话 ID 的 CloudWatch 日志。会话 ID 包含在 MediaTailor 提供的播放端点中。有关更多信息，请参阅 [Verify that the debug log mode is active for your playback session](#debug-active)。

### 客户端报告
<a name="client-side-reporting"></a>

要进行客户端报告，请在客户端的`POST HTTP`会话初始化请求正文中将`logMode`键和`DEBUG`值添加到 MediaTailor /v1/session 端点。有关客户端报告的一般信息，请参阅[客户端](https://docs.aws.amazon.com/mediatailor/latest/ug/ad-reporting-client-side.html)报告。

**重要**  
`DEBUG` 值区分大小写。

 将日志模式设置为调试后，我们建议您验证调试会话是否处于活动状态。要验证调试会话是否处于`SESSION_INITIALIZED`活动状态，请确认 CloudWatch 日志中存在与会话 ID 关联的事件。会话 ID 包含在 MediaTailor 提供的播放端点中。有关更多信息，请参阅 [Verify that the debug log mode is active for your playback session](#debug-active)。

## 最大活跃调试会话数
<a name="maximum-active-debug-log-sessions"></a>

您最多可以有 10 个活跃的调试日志会话。当您的播放器向发送会话初始化或播放请求时 MediaTailor，会 MediaTailor 检查是否已达到限制。如果有，请 MediaTailor 检查是否有任何陈旧的会话。如果会话在一定时间内未被访问，则该会话将失效。对于直播，此时间段为 10 分钟，对于 VOD 直播，此时间段为 30 分钟。

如果已达到活动调试日志会话的最大限制，则调试日志不会写入会话的 CloudWatch 日志。如果您在会话日志中看不到调试 CloudWatch 日志，则可能已达到此限制。要确认是否已达到限制，请参阅[Verify that the debug log mode is active for your playback session](#debug-active)。

## 调试日志字段
<a name="debug-log-mode-fields"></a>

 下表列出了 MediaTailor 写入的调试日志字段 CloudWatch。


| 字段 | 说明 | 
| --- | --- | 
| awsAccountId | 你的 AWS 账户 身份证。 | 
| customerId | 您的 MediaTailor 客户 ID。 | 
| eventTimestamp | 与调试日志事件关联的 ISO 8601 时间戳。 | 
| eventType | 调试日志事件的类型。值：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/mediatailor/latest/ug/debug-log-mode.html) | 
| originRequestUrl | 为此请求检索到的您的源服务器的 URL。 | 
| mediaTailorPath | 被调用的 MediaTailor 端点，包括在初始清单请求 MediaTailor 中传递给的任何参数。 | 
| requestId | 向发出的特定 HTTP 请求的 ID MediaTailor。 | 
| responseBody | 响应正文中的清单来自 MediaTailor。这要么是原始来源清单，要么是生成的清单 MediaTailor。 | 
| sessionId | 播放会话 ID。 | 
| sessionType | 播放会话的类型。值：`HLS`、`DASH` | 

## 阅读调试日志
<a name="read-the-debug-logs"></a>

MediaTailor 将调试日志写入 Amazon CloudWatch 日志。通常 CloudWatch 会收取日志费用。使用 CloudWatch Insights 读取调试日志。有关如何使用 [Lo CloudWatch gs Insights 的信息，请参阅 *AWS CloudWatch 日志用户指南中的使用 CloudWatch 日志*见解分析日志数据](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html)。

**注意**  
调试日志可能需要几分钟才能显示在中 CloudWatch。如果您没有看到日志，请等待几分钟，然后重试。如果您仍然看不到日志，则可能是您已达到活动调试日志会话的最大数量。要验证是否是这种情况，请运行 CloudWatch 查询以查看是否有针对您的播放会话初始化的调试会话。有关更多信息，请参阅 [Verify that the debug log mode is active for your playback session](#debug-active)。

### 示例
<a name="query-examples"></a>

 本节包括可用于读取 MediaTailor调试日志数据的示例查询。

**Example 1：验证您的播放会话的调试日志模式是否处于活动状态**  

```
fields @timestamp, @message
 | filter sessionId = "32002de2-837c-4e3e-9660-f3075e8dfd90"
 | filter eventType = "SESSION_INITIALIZED" # client-side reporting
 or mediaTailorPath like “/v1/master" # server-side reporting HLS
 or mediaTailorPath like “/v1/dash" # server-side reporting DASH
```

**Example 2：查看来自你的来源的回复**  

```
fields @timestamp, responseBody, @message, mediaTailorPath
 | filter eventType = "ORIGIN_MANIFEST" and sessionId = "32002de2-837c-4e3e-9660-f3075e8dfd90"
```

**Example 3：查看 MediaTailor 为给定会话生成的清单**  

```
fields @timestamp, responseBody, @message
 | filter mediaTailorPath like "/v1/master/" and eventType = "GENERATED_MANIFEST" and sessionId = "32002de2-837c-4e3e-9660-f3075e8dfd90"
```

**Example 4：查看给定事件的所有事件 `requestId`**  
 使用此查询可以查看由生成的源清单和清单 MediaTailor。  

```
fields @timestamp, responseBody, @message, mediaTailorPath
 | filter requestId = "e5ba82a5-f8ac-4efb-88a0-55bed21c45b4"
```