监视和日志记录Monitoring and logging

本文介绍如何从 IoT Edge 模块上的实时视频分析接收事件以进行远程监视。In this article, you'll learn how to receive events for remote monitoring from the Live Video Analytics on IoT Edge module.

此外还介绍如何控制模块生成的日志。You'll also learn how to control the logs that the module generates.

事件的分类Taxonomy of events

IoT Edge 上的实时视频分析根据以下分类发出事件或遥测数据:Live Video Analytics on IoT Edge emits events, or telemetry data, according to the following taxonomy:

显示事件分类的关系图。

  • 操作:通过用户操作生成的事件,或在执行媒体图期间生成的事件Operational: Events generated by the actions of a user or during the execution of a media graph

    • 数量:应较低(每分钟几次,甚至更低)Volume: Expected to be low (a few times a minute, or even less)

    • 示例:Examples:

      • 记录已开始(如以下示例所示)Recording started (shown in the following example)
      • 记录已停止Recording stopped
      {
        "body": {
          "outputType": "assetName",
          "outputLocation": "sampleAssetFromEVR-LVAEdge-20200512T233309Z"
        },
        "applicationProperties": {
          "topic": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/<my-resource-group>/providers/microsoft.media/mediaservices/<ams-account-name>",
          "subject": "/graphInstances/Sample-Graph-2/sinks/assetSink",
          "eventType": "Microsoft.Media.Graph.Operational.RecordingStarted",
          "eventTime": "2020-05-12T23:33:10.392Z",
          "dataVersion": "1.0"
        }
      }
      
  • 诊断:有助于诊断性能问题的事件Diagnostics: Events that help to diagnose problems with performance

    • 数量:可能很高(每分钟几次)Volume: Can be high (several times a minute)

    • 示例:Examples:

      • RTSP SDP 信息(如以下示例所示)RTSP SDP information (shown in the following example)
      • 传入视频源中的间隔Gaps in the incoming video feed
      {
        "body": {
          "sdp": "SDP:\nv=0\r\no=- 1589326384077235 1 IN IP4 XXX.XX.XX.XXX\r\ns=Matroska video+audio+(optional)subtitles, streamed by the LIVE555 Media Server\r\ni=media/lots_015.mkv\r\nt=0 0\r\na=tool:LIVE555 Streaming Media v2020.04.12\r\na=type:broadcast\r\na=control:*\r\na=range:npt=0-73.000\r\na=x-qt-text-nam:Matroska video+audio+(optional)subtitles, streamed by the LIVE555 Media Server\r\na=x-qt-text-inf:media/lots_015.mkv\r\nm=video 0 RTP/AVP 96\r\nc=IN IP4 0.0.0.0\r\nb=AS:500\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\na=control:track1\r\n"
        },
        "applicationProperties": {
          "topic": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/<my-resource-group>/providers/microsoft.media/mediaservices/<ams-account-name>",
          "subject": "/graphInstances/Sample-Graph-2/sources/rtspSource",
          "eventType": "Microsoft.Media.Graph.Diagnostics.MediaSessionEstablished",
          "eventTime": "2020-05-12T23:33:04.077Z",
          "dataVersion": "1.0"
        }
      }
      
  • 分析:在视频分析过程中生成的事件Analytics: Events generated as part of video analysis

    • 数量:可能很高(每分钟几次或更高)Volume: Can be high (several times a minute or more)

    • 示例:Examples:

      • 检测到动作(如以下示例所示)Motion detected (shown in the following example)
      • 推理结果Inference result
    {
       "body": {
         "timestamp": 143039375044290,
         "inferences": [
           {
             "type": "motion",
             "motion": {
               "box": {
                 "l": 0.48954,
                 "t": 0.140741,
                 "w": 0.075,
                 "h": 0.058824
               }
             }
           }
         ]
       },
       "applicationProperties": {
         "topic": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/<my-resource-group>/providers/microsoft.media/mediaservices/<ams-account-name>",
         "subject": "/graphInstances/Sample-Graph-2/processors/md",
         "eventType": "Microsoft.Media.Graph.Analytics.Inference",
         "eventTime": "2020-05-12T23:33:09.381Z",
         "dataVersion": "1.0"
       }
    }
    

模块发出的事件会发送到 IoT Edge 中心The events emitted by the module are sent to the IoT Edge hub. 然后可以从那里路由到其他目标。They can be routed from there to other destinations.

分析事件中的时间戳Timestamps in analytic events

如上所示,在视频分析过程中生成的事件具有关联的时间戳。As indicated previously, events generated as part of video analysis have timestamps associated with them. 如果将实时视频录制为图拓扑的一部分,则这些时间戳有助于你定位录制的视频中发生特定事件的位置。If you recorded the live video as part of your graph topology, these timestamps help you locate where in the recorded video the particular event occurred. 以下是有关如何将分析事件中的时间戳映射到已录制成 Azure 媒体服务资产的视频的时间线的指导原则。Following are guidelines on how to map the timestamp in an analytic event to the timeline of the video recorded into an Azure Media Services asset.

首先,提取 eventTime 值。First, extract the eventTime value. 时间范围筛选器中使用此值检索录制的适当部分。Use this value in a time range filter to retrieve a suitable portion of the recording. 例如,你可能希望检索在 eventTime 之前 30 秒开始并在其之后 30 秒结束的视频。For example, you might want to retrieve video that starts 30 seconds before eventTime and ends 30 seconds after it. 对于上一示例(其中的 eventTime 为 2020-05-12T23:33:09.381Z),对 eventTime 之前和之后 30 秒的 HLS 清单的请求与以下请求类似:For the previous example, where eventTime is 2020-05-12T23:33:09.381Z, a request for an HLS manifest for the 30 seconds before and after eventTime would look like this request:

https://{hostname-here}/{locatorGUID}/content.ism/manifest(format=m3u8-aapl,startTime=2020-05-12T23:32:39Z,endTime=2020-05-12T23:33:39Z).m3u8

上面的 URL 会返回一个主播放列表,其中包含媒体播放列表的 URL。The preceding URL would return a master playlist that contains URLs for media playlists. 媒体播放列表会包含如下所示的条目:The media playlist would contain entries like this one:

...
#EXTINF:3.103011,no-desc
Fragments(video=143039375031270,format=m3u8-aapl)
...

上面的条目报告有一个从 timestamp143039375031270 开始的视频片段。The preceding entry reports that a video fragment is available that starts at a timestamp value of 143039375031270. 分析事件中的 timestamp 值使用与媒体播放列表相同的时间刻度,The timestamp value in the analytic event uses the same timescale as the media playlist. 可用于标识相关的视频片段,以及查找正确的帧。It can be used to identify the relevant video fragment and seek to the correct frame.

有关详细信息,请参阅有关在 HLS 中进行精确到帧的查找的文章For more information, see these articles on frame-accurate seeking in HLS.

控制事件Controlling events

你可以使用以下模块孪生属性,控制由 IoT Edge 模块上的实时视频分析发布的操作和诊断事件。You can use the following module twin properties to control the operational and diagnostic events published by the Live Video Analytics on IoT Edge module. 模块孪生 JSON 架构中介绍了这些属性。These properties are documented in the module twin JSON schema.

  • diagnosticsEventsOutputName:若要从模块中获取诊断事件,请包括此属性并为它提供任意值。diagnosticsEventsOutputName: To get diagnostic events from the module, include this property and provide any value for it. 忽略它或将它留空可阻止模块发布诊断事件。Omit it or leave it empty to stop the module from publishing diagnostic events.

  • operationalEventsOutputName:若要从模块中获取操作事件,请包括此属性并为它提供任意值。operationalEventsOutputName: To get operational events from the module, include this property and provide any value for it. 忽略它或将它留空可阻止模块发布操作事件。Omit it or leave it empty to stop the module from publishing operational events.

分析事件由动作检测处理器或 HTTP 扩展处理器等节点生成。Analytics events are generated by nodes like the motion detection processor or the HTTP extension processor. IoT 中心接收器用于将它们发送到 IoT Edge 中心。The IoT hub sink is used to send them to the IoT Edge hub.

可以通过使用部署清单中 $edgeHub 模块孪生的 desired 属性控制以上所有事件的路由You can control the routing of all the preceding events by using the desired property of the $edgeHub module twin in the deployment manifest:

 "$edgeHub": {
   "properties.desired": {
     "schemaVersion": "1.0",
     "routes": {
       "moduleToHub": "FROM /messages/modules/lvaEdge/outputs/* INTO $upstream"
     },
     "storeAndForwardConfiguration": {
       "timeToLiveSecs": 7200
     }
   }
 }

在上面的 JSON 中,lvaEdge 是 IoT Edge 模块上实时视频分析的名称。In the preceding JSON, lvaEdge is the name of the Live Video Analytics on IoT Edge module. 路由规则遵循声明路由中定义的架构。The routing rule follows the schema defined in Declare routes.

备注

为了确保分析事件到达 IoT Edge 中心,在任何动作检测处理器节点和/或任何 HTTP 扩展处理器节点的下游都需要有一个 IoT 中心接收器节点。To ensure that analytics events reach the IoT Edge hub, you need to have an IoT hub sink node downstream of any motion detection processor node and/or any HTTP extension processor node.

事件架构Event schema

事件来自边缘设备,并且可以在边缘或云中使用。Events originate on the edge device and can be consumed at the edge or in the cloud. 由 IoT Edge 上的实时视频分析生成的事件遵循由 Azure IoT 中心建立的流式处理消息传送模式Events generated by Live Video Analytics on IoT Edge conform to the streaming messaging pattern established by Azure IoT Hub. 此模式包含系统属性、应用程序属性和正文。The pattern consists of system properties, application properties, and a body.

总结Summary

每个事件(在通过 IoT 中心观察到时)都有一组共同属性:Every event, when observed via IoT Hub, has a set of common properties:

propertiesProperty 属性类型Property type 数据类型Data type 说明Description
message-id systemsystem GUIDguid 唯一的事件 ID。Unique event ID.
topic applicationPropertyapplicationProperty stringstring Azure 媒体服务帐户的 Azure 资源管理器路径。Azure Resource Manager path for the Azure Media Services account.
subject applicationPropertyapplicationProperty stringstring 发出事件的实体的子路径。Subpath of the entity emitting the event.
eventTime applicationPropertyapplicationProperty stringstring 生成事件的时间。Time the event was generated.
eventType applicationPropertyapplicationProperty stringstring 事件类型标识符。Event type identifier. (请参阅以下部分。)(See the following section.)
body bodybody objectobject 特定事件数据。Particular event data.
dataVersion applicationPropertyapplicationProperty stringstring {Major}.{Minor}{Major}.{Minor}

属性Properties

message-idmessage-id

事件的全局唯一标识符 (GUID)。A globally unique identifier (GUID) for the event.

主题topic

表示与图关联的 Azure 媒体服务帐户。Represents the Azure Media Services account associated with the graph.

/subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Media/mediaServices/{accountName}

subjectsubject

发出事件的实体:The entity that's emitting the event:

/graphInstances/{graphInstanceName}
/graphInstances/{graphInstanceName}/sources/{sourceName}
/graphInstances/{graphInstanceName}/processors/{processorName}
/graphInstances/{graphInstanceName}/sinks/{sinkName}

subject 属性用于将一般事件映射到生成模块。The subject property allows you to map generic events to the generating module. 例如,对于无效 RTSP 用户名或密码,生成的事件将是 /graphInstances/myGraph/sources/myRtspSource 节点上的 Microsoft.Media.Graph.Diagnostics.ProtocolErrorFor example, for an invalid RTSP user name or password, the generated event would be Microsoft.Media.Graph.Diagnostics.ProtocolError on the /graphInstances/myGraph/sources/myRtspSource node.

事件类型Event types

事件类型根据以下架构分配给命名空间:Event types are assigned to a namespace according to this schema:

Microsoft.Media.Graph.{EventClass}.{EventType}

事件类Event classes

类名Class name 说明Description
分析Analytics 在内容分析过程中生成的事件。Events generated as part of content analysis.
诊断Diagnostics 有助于对问题和性能进行诊断的事件。Events that help with the diagnostics of problems and performance.
可运行Operational 在资源操作过程中生成的事件。Events generated as part of resource operation.

事件类型特定于每个事件类。The event types are specific to each event class.

示例:Examples:

  • Microsoft.Media.Graph.Analytics.Inference
  • Microsoft.Media.Graph.Diagnostics.AuthorizationError
  • Microsoft.Media.Graph.Operational.GraphInstanceStarted

事件时间Event time

事件时间采用 ISO 8601 字符串格式。Event time is formatted in an ISO 8601 string. 它表示事件的发生时间。It represents the time when the event occurred.

通过 Telegraf 进行 Azure Monitor 收集Azure Monitor collection via Telegraf

这些指标将通过 IoT Edge 模块上的实时视频分析进行报告:These metrics will be reported from the Live Video Analytics on IoT Edge module:

指标名称Metric name 类型Type LabelLabel 说明Description
lva_active_graph_instanceslva_active_graph_instances 仪表Gauge iothub、edge_device、module_name、graph_topologyiothub, edge_device, module_name, graph_topology 每个拓扑的活动图形总数。Total number of active graphs per topology.
lva_received_bytes_totallva_received_bytes_total 计数器Counter iothub、edge_device、module_name、graph_topology、graph_instance、graph_nodeiothub, edge_device, module_name, graph_topology, graph_instance, graph_node 一个节点接收的字节总数。Total number of bytes received by a node. 仅支持用于 RTSP 源。Supported only for RTSP sources.
lva_data_dropped_totallva_data_dropped_total 计数器Counter iothub、edge_device、module_name、graph_topology、graph_instance、graph_node、data_kindiothub, edge_device, module_name, graph_topology, graph_instance, graph_node, data_kind 任何已删除数据(事件、媒体等)的计数器。Counter of any dropped data (events, media, and so on).

备注

在容器的端口 9600 上公开了 Prometheus 终结点A Prometheus endpoint is exposed at port 9600 of the container. 如果你将 IoT Edge 模块上的实时视频分析命名为“lvaEdge”,则它们能够通过向 http://lvaEdge:9600/metrics 发送 GET 请求来访问指标。If you name your Live Video Analytics on IoT Edge module "lvaEdge," they will be able to access metrics by sending a GET request to http://lvaEdge:9600/metrics.

请按照以下步骤,从 IoT Edge 模块上的实时视频分析启用指标收集:Follow these steps to enable the collection of metrics from the Live Video Analytics on IoT Edge module:

  1. 在开发计算机上创建一个文件夹,并转到该文件夹。Create a folder on your development computer, and go to that folder.

  2. 在该文件夹中创建一个包含以下配置的 telegraf.toml 文件:In the folder, create a telegraf.toml file that contains the following configurations:

    [agent]
        interval = "30s"
        omit_hostname = true
    
    [[inputs.prometheus]]
      metric_version = 2
      urls = ["http://edgeHub:9600/metrics", "http://edgeAgent:9600/metrics", "http://{LVA_EDGE_MODULE_NAME}:9600/metrics"]
    
    [[outputs.azure_monitor]]
      namespace_prefix = "lvaEdge"
      region = "westus"
      resource_id = "/subscriptions/{SUBSCRIPTON_ID}/resourceGroups/{RESOURCE_GROUP}/providers/Microsoft.Devices/IotHubs/{IOT_HUB_NAME}"
    

    重要

    请务必替换 .toml 文件中的变量。Be sure to replace the variables in the .toml file. 变量由大括号 ({}) 表示。The variables are denoted by braces ({}).

  3. 在同一文件夹中创建包含以下命令的 Dockerfile:In the same folder, create a Dockerfile that contains the following commands:

        FROM telegraf:1.15.3-alpine
        COPY telegraf.toml /etc/telegraf/telegraf.conf
    
  4. 使用 Docker CLI 命令生成 Docker 文件,并将该映像发布到 Azure 容器注册表。Use Docker CLI commands to build the Docker file and publish the image to your Azure container registry.

    若要详细了解如何使用 Docker CLI 将映像推送到容器注册表,请参阅推送和拉取 Docker 映像For more information about using the Docker CLI to push to a container registry, see Push and pull Docker images. 有关 Azure 容器注册表的其他信息,请参阅文档For other information about Azure Container Registry, see the documentation.

  5. 推送到 Azure 容器注册表以后,请将以下节点添加到部署清单文件:After the push to Azure Container Registry is complete, add the following node to your deployment manifest file:

    "telegraf": 
    {
      "settings": 
        {
            "image": "{AZURE_CONTAINER_REGISTRY_LINK_TO_YOUR_TELEGRAF_IMAGE}"
        },
      "type": "docker",
      "version": "1.0",
      "status": "running",
      "restartPolicy": "always",
      "env": 
        {
            "AZURE_TENANT_ID": { "value": "{YOUR_TENANT_ID}" },
            "AZURE_CLIENT_ID": { "value": "{YOUR CLIENT_ID}" },
            "AZURE_CLIENT_SECRET": { "value": "{YOUR_CLIENT_SECRET}" }
        }
    

    重要

    请务必替换清单文件中的变量。Be sure to replace the variables in the manifest file. 变量由大括号 ({}) 表示。The variables are denoted by braces ({}).

    Azure Monitor 可通过服务主体进行身份验证Azure Monitor can be authenticated via service principal.

    Azure Monitor Telegraf 插件公开了多种身份验证方法The Azure Monitor Telegraf plug-in exposes several methods of authentication.

  6. 若要使用服务主体身份验证,请设置以下环境变量:To use service principal authentication, set these environment variables:
    AZURE_TENANT_ID:指定要向其进行身份验证的租户。AZURE_TENANT_ID: Specifies the tenant to authenticate to.
    AZURE_CLIENT_ID:指定要使用的应用客户端 ID。AZURE_CLIENT_ID: Specifies the app client ID to use.
    AZURE_CLIENT_SECRET:指定要使用的应用机密。AZURE_CLIENT_SECRET: Specifies the app secret to use.

    提示

    可为服务主体提供“监视指标发布者”角色。You can give the service principal the Monitoring Metrics Publisher role.

  7. 部署模块后,指标会显示在 Azure Monitor 中的单个命名空间下。After the modules are deployed, metrics will appear in Azure Monitor under a single namespace. 指标名称将与 Prometheus 发出的名称匹配。Metric names will match the ones emitted by Prometheus.

    这种情况下,请在 Azure 门户中转到 IoT 中心,并在左窗格中选择“指标”。In this case, in the Azure portal, go to the IoT hub and select Metrics in the left pane. 你应会在那里看到指标。You should see the metrics there.

Log Analytics 指标集合Log Analytics metrics collection

使用 Prometheus 终结点Log Analytics,可以生成和监视指标,例如使用的 CPUPercent、MemoryUsedPercent 等。Using Prometheus endpoint along with Log Analytics, you can generate and monitor metrics such as used CPUPercent, MemoryUsedPercent, etc.

备注

下面的配置不会收集日志,只收集指标。The configuration below does not collect logs, only metrics. 可以扩展收集器模块来同时收集和上传日志。It is feasible to extend the collector module to also collect and upload logs.

使用 Log Analytics 显示指标集合的关系图。 Diagram that shows the metrics collection using Log Analytics.

  1. 了解如何收集指标Learn how to collect metrics

  2. 使用 Docker CLI 命令生成 Docker 文件,并将该映像发布到 Azure 容器注册表。Use Docker CLI commands to build the Docker file and publish the image to your Azure container registry.

    若要详细了解如何使用 Docker CLI 将映像推送到容器注册表,请参阅推送和拉取 Docker 映像For more information about using the Docker CLI to push to a container registry, see Push and pull Docker images. 有关 Azure 容器注册表的其他信息,请参阅文档For other information about Azure Container Registry, see the documentation.

  3. 推送到 Azure 容器注册表以后,以下内容将插入到部署清单文件中:After the push to Azure Container Registry is complete, the following is inserted into the deployment manifest:

    "azmAgent": {
      "settings": {
        "image": "{AZURE_CONTAINER_REGISTRY_LINK_TO_YOUR_METRICS_COLLECTOR}"
      },
      "type": "docker",
      "version": "1.0",
      "status": "running",
      "restartPolicy": "always",
      "env": {
        "LogAnalyticsWorkspaceId": { "value": "{YOUR_LOG_ANALYTICS_WORKSPACE_ID}" },
        "LogAnalyticsSharedKey": { "value": "{YOUR_LOG_ANALYTICS_WORKSPACE_SECRET}" },
        "LogAnalyticsLogType": { "value": "IoTEdgeMetrics" },
        "MetricsEndpointsCSV": { "value": "http://edgeHub:9600/metrics,http://edgeAgent:9600/metrics,http://lvaEdge:9600/metrics" },
        "ScrapeFrequencyInSecs": { "value": "30 " },
        "UploadTarget": { "value": "AzureLogAnalytics" }
      }
    }
    

    备注

    模块 edgeHubedgeAgentlvaEdge 是部署清单文件中定义的模块的名称。The modules edgeHub, edgeAgent and lvaEdge are the names of the modules defined in the deployment manifest file. 请确保模块的名称匹配。Please make sure that the names of the modules match.

    可以通过以下步骤获取 LogAnalyticsWorkspaceIdLogAnalyticsSharedKey 值:You can get your LogAnalyticsWorkspaceId and LogAnalyticsSharedKey values by following these steps:

    1. 转到 Azure 门户Go to the Azure portal
    2. 查找 Log Analytics 工作区Look for your Log Analytics workspaces
    3. 找到 Log Analytics 工作区后,导航到左侧导航窗格中的 Agents management 选项。Once you find your Log Analytics workspace, navigate to the Agents management option in the left navigation pane.
    4. 你将找到可使用的工作区 ID 和密钥。You will find the Workspace ID and the Secret Keys that you can use.
  4. 接下来,通过单击左侧导航窗格中的 Workbooks 选项卡来创建工作簿。Next, create a workbook by clicking on the Workbooks tab in the left navigation pane.

  5. 使用 Kusto 查询语言可以编写如下查询,并获得 IoT Edge 模块使用的 CPU 百分比。Using Kusto query language, you can write queries as below and get CPU percentage used by the IoT Edge modules.

    let cpu_metrics = IoTEdgeMetrics_CL
    | where Name_s == "edgeAgent_used_cpu_percent"
    | extend dimensions = parse_json(Tags_s)
    | extend module_name = tostring(dimensions.module_name)
    | where module_name in ("lvaEdge","yolov3","tinyyolov3")
    | summarize cpu_percent = avg(Value_d) by bin(TimeGenerated, 5s), module_name;
    cpu_metrics
    | summarize cpu_percent = sum(cpu_percent) by TimeGenerated
    | extend module_name = "Total"
    | union cpu_metrics
    

    示意图显示使用 Kusto 查询的指标。 Diagram that shows the metrics using Kusto query.

日志记录Logging

与其他 IoT Edge 模块一样,你也可以检查边缘设备上的容器日志As with other IoT Edge modules, you can also examine the container logs on the edge device. 可以通过使用以下模块孪生属性来配置写入到日志中的信息:You can configure the information that's written to the logs by using the following module twin properties:

  • logLevel

    • 允许使用的值为 VerboseInformationWarningErrorNoneAllowed values are Verbose, Information, Warning, Error, and None.
    • 默认值为 InformationThe default value is Information. 日志将包含错误消息、警告消息和信息性消息。The logs will contain error, warning, and information messages.
    • 如果将值设置为“Warning”,则日志将包含错误消息和警告消息。If you set the value to Warning, the logs will contain error and warning messages.
    • 如果将值设置为“Error”,则日志将仅包含错误消息。If you set the value to Error, the logs will contain only error messages.
    • 如果将值设置为“None”,则不会生成任何日志。If you set the value to None, no logs will be generated. (不建议采用此配置。)(We don't recommend this configuration.)
    • 只有在需要与 Azure 支持共享日志以诊断问题时,才使用“Verbose”。Use Verbose only if you need to share logs with Azure support to diagnose a problem.
  • logCategories

    • 以逗号分隔的以下一个或多个值的列表:ApplicationEventsMediaPipelineA comma-separated list of one or more of these values: Application, Events, MediaPipeline.
    • 默认值为 Application, EventsThe default value is Application, Events.
    • Application:来自模块的概要信息,例如模块启动消息、环境错误和直接方法调用。Application: High-level information from the module, like module startup messages, environment errors, and direct method calls.
    • Events:本文前面介绍的所有事件。Events: All the events that were described earlier in this article.
    • MediaPipeline:低级别的日志,可在你排查问题(例如,与支持 RTSP 的相机建立连接时遇到困难)时提供见解。MediaPipeline: Low-level logs that might offer insight when you're troubleshooting problems, like difficulties establishing a connection with an RTSP-capable camera.

生成调试日志Generating debug logs

在某些情况下,可能需要生成比上述日志更详细的日志才能帮助 Azure 支持解决问题。In certain cases, to help Azure support resolve a problem, you might need to generate more detailed logs than the ones described previously. 若要生成这些日志,请执行以下操作:To generate these logs:

  1. 通过 createOptions 将模块存储链接到设备存储Link the module storage to the device storage via createOptions. 如果你查看快速入门中的部署清单模板,则会看到以下代码:If you look at a deployment manifest template from the quickstarts, you'll see this code:

    "createOptions": {
      …
      "Binds": [
        "/var/local/mediaservices/:/var/lib/azuremediaservices/"
      ]
     }
    

    此代码让 Edge 模块将日志写入设备存储路径 /var/local/mediaservices/This code lets the Edge module write logs to the device storage path /var/local/mediaservices/.

  2. 将以下 desired 属性添加到模块:Add the following desired property to the module:

    "debugLogsDirectory": "/var/lib/azuremediaservices/debuglogs/",

现在,该模块会以二进制格式将调试日志写入到设备存储路径 /var/local/mediaservices/debuglogs/The module will now write debug logs in a binary format to the device storage path /var/local/mediaservices/debuglogs/. 你可以与 Azure 支持共享这些日志。You can share these logs with Azure support.

常见问题解答FAQ

如有问题,请参阅监视和指标常见问题解答If you have questions, see the monitoring and metrics FAQ.

后续步骤Next steps

连续视频录制Continuous video recording