UiPath Documentation
automation-suite
2023.4
false
EKS/AKS 上的 Automation Suite 安装指南
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

配置日志规则

概述

机器人日志可捕获诊断日志和执行日志。您可以配置 Insights 用于提取机器人日志的条件。例如,您只想捕获包含特定名称的流程的日志。

有关更多信息,请参阅机器人日志

何时配置日志规则

  • 安装 Insights 后。
  • 升级 Insights 后。
  • 当您要添加或配置现有日志规则时。

默认日志规则

Insights 用于提取的机器人日志的默认设置包括“仅提取最新日志和错误日志”。以下部分显示的内容为您正在运行的 Insights 版本所用的默认日志规则。

2022.4 及更高版本的默认日志规则

在此示例中,系统会提取所有流程的最新日志和错误日志。此版本的 Insights 从已执行流程的机器人中提取最新的 Info 级别的日志,以及流程和 Error 级别的日志,如以下示例所示。

<logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
        <filters defaultAction="Ignore">
          <when condition="level &gt;= LogLevel.Error or ends-with('${message}',' execution ended')" action="Log" />
          <when condition="'${ui-robot-logs-num-custom-fields}' &gt; 1 and not ends-with('${message}', ' execution started')" action="Log" />
        </filters><logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
        <filters defaultAction="Ignore">
          <when condition="level &gt;= LogLevel.Error or ends-with('${message}',' execution ended')" action="Log" />
          <when condition="'${ui-robot-logs-num-custom-fields}' &gt; 1 and not ends-with('${message}', ' execution started')" action="Log" />
        </filters>

版本 2021.10 的默认日志规则

在此示例中,提取所有流程的所有日志(Info 级别及更高级别)。此版本的 Insights 会提取机器人为所有流程生成的所有日志(Info 级别及更高级别),如以下示例所示。

<logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs"/><logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs"/>

配置日志规则

您可以在 nlog.custom.config 文件中配置 Orchestrator 设置。要修改设置,请执行以下步骤:
  1. 将新的日志规则放置在nlog.custom.config文件中。请查看以下详细信息中的示例:
    {
      "10_Robot_Insights": {
        "logger": "Robot.*",
        "ruleName": "insightsRobotLogsRule",
        "minLevel": "Info",
        "writeTo": "insightsRobotLogs",
        "enabled": false,
        "final": false,
        "filters": {
          "defaultAction": "Ignore",
          "conditions": [
            {
              "condition": "level >= LogLevel.Error or ends-with('${message}', ' execution ended')",
              "action": "Log"
            }
          ]
        }
      }
    }{
      "10_Robot_Insights": {
        "logger": "Robot.*",
        "ruleName": "insightsRobotLogsRule",
        "minLevel": "Info",
        "writeTo": "insightsRobotLogs",
        "enabled": false,
        "final": false,
        "filters": {
          "defaultAction": "Ignore",
          "conditions": [
            {
              "condition": "level >= LogLevel.Error or ends-with('${message}', ' execution ended')",
              "action": "Log"
            }
          ]
        }
      }
    }
  2. 使用Orchestrator 配置程序工具更新配置。 使用以下命令将自定义nlog.custom.config文件中的键与orchestrator-customconfig配置映射中已可用的设置合并。
     ./orchestrator-configurator.sh -l nlog.custom.config ./orchestrator-configurator.sh -l nlog.custom.config
    此命令不会删除任何现有设置。

日志规则示例

在以下示例中,我们仅发送超过一定级别或包含表示执行已结束消息的日志:

{
  "10_Robot_Insights": {
    "logger": "Robot.*",
    "ruleName": "insightsRobotLogsRule",
    "minLevel": "Info",
    "writeTo": "insightsRobotLogs",
    "enabled": false,
    "final": false,
    "filters": {
      "defaultAction": "Ignore",
      "conditions": [
        {
          "condition": "level >= LogLevel.Error or ends-with('${message}', ' execution ended')",
          "action": "Log"
        }
      ]
    }
  }
}{
  "10_Robot_Insights": {
    "logger": "Robot.*",
    "ruleName": "insightsRobotLogsRule",
    "minLevel": "Info",
    "writeTo": "insightsRobotLogs",
    "enabled": false,
    "final": false,
    "filters": {
      "defaultAction": "Ignore",
      "conditions": [
        {
          "condition": "level >= LogLevel.Error or ends-with('${message}', ' execution ended')",
          "action": "Log"
        }
      ]
    }
  }
}

提取特定流程的所有日志和任何错误日志

在以下示例中,Insights 会针对下列流程,提取所有 Info 级别和 Error 级别的日志:payment disp68fields68fields_20
<logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
    <filters defaultAction="Ignore">
      <when condition="equals('${event-properties:item=processName}', 'payment disp') or equals('${event-properties:item=processName}', '68fields') or equals('${event-properties:item=processName}', '68fields_20')" action="Log" />
    </filters>
  </logger><logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
    <filters defaultAction="Ignore">
      <when condition="equals('${event-properties:item=processName}', 'payment disp') or equals('${event-properties:item=processName}', '68fields') or equals('${event-properties:item=processName}', '68fields_20')" action="Log" />
    </filters>
  </logger>

仅提取特定流程的最新日志和错误日志

在以下示例中,Insights 仅会针对下列流程,提取最新的 Info 级别日志和 Error 级别日志:payment disp68fields68fields_20

系统仅会将每个机器人的 Error 级别的日志和最新日志记录到 Insights。

<logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
    <filters defaultAction="Ignore">
      <when condition="(level >= LogLevel.Error or ends-with('${message}',' execution ended')) and (contains('${event-properties:item=processName}', 'payment disp') or equals('${event-properties:item=processName}', '68fields') or equals('${event-properties:item=processName}', '68fields_20'))" action="Log" />
    </filters>
  </logger><logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
    <filters defaultAction="Ignore">
      <when condition="(level >= LogLevel.Error or ends-with('${message}',' execution ended')) and (contains('${event-properties:item=processName}', 'payment disp') or equals('${event-properties:item=processName}', '68fields') or equals('${event-properties:item=processName}', '68fields_20'))" action="Log" />
    </filters>
  </logger>

不要提取特定流程的日志

在以下示例中,Insights 不会为名为 payment disp 的流程提取任何日志。
<logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
    <filters defaultAction="Log">
      <when condition="equals('${event-properties:item=processName}', 'payment disp')" action="Ignore" />
    </filters>
  </logger><logger name="Robot.*" ruleName="insightsRobotLogsRule" enabled="true" minlevel="Info" writeTo="insightsRobotLogs">
    <filters defaultAction="Log">
      <when condition="equals('${event-properties:item=processName}', 'payment disp')" action="Ignore" />
    </filters>
  </logger>

相关文章

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新