UiPath Documentation
insights
2022.4
false
Insights
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

配置日志规则

概述

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

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

To find out how to capture logs if needed to debug with the support team, check out Capturing logs page.

何时配置日志规则

默认日志规则

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"/>

配置日志规则

备注:
  • 只有管理员才能更改 Orchestrator 配置文件中的值。
  • 在继续之前备份 UiPath.Orchestrator.dll.config 文件。您可以在 C:\)\)Program Files (x86)\)\)UiPath\)\)Orchestrator 中找到该文件。
  • 更改 Orchestrator 配置文件后重新启动网站。
  • 所有参数都区分大小写。
  • 为获得最佳性能,两年内生成的机器人日志不应超过 2 亿条记录。
  • 使用 NLog 配置文件在您的环境中捕获与 Insights 相关的数据,并减少机器人日志生成的记录数量。
  1. 导航到 C:\Program Files (x86)UiPath\Orchestrator,然后打开 UiPath.Orchestrator.dll.config 文件以修改 Orchestrator 设置。
  2. 查找“机器人日志”参数(例如 <logger name="Robot.*" environmentSpecificConfiguration/>
  3. 使用默认操作配置筛选条件(例如 filters defaultAction="Ignore")。
  4. Configure conditions based on the log level or other events (see Log rules example).
  5. 保存文件并重新启动 Orchestrator。

有关配置 Orchestrator 配置文件的更多信息,请参阅UiPath.Orchestrator.dll.config

日志规则示例

以下示例显示了 Info 和 Error 级别日志的自定义日志规则配置。通过设置特定条件,Insights 将仅针对您配置的流程提取日志。

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

在以下示例中,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 论坛

保持更新