
Orchestrator 用户指南
Orchestrator 日志
linkOrchestrator 诊断日志
link这些是 UiPath™ Orchestrator 生成的有关其行为的诊断日志。
启用 UiPath Orchestrator 诊断日志
UiPath.Orchestrator.dll.config
文件中的 <nlog>
标签下找到。
UiPath Orchestrator 诊断日志的目标
UiPath.Orchestrator.dll.config
文件中的以下行指定:
<target xsi:type="EventLog" name="eventLog" layout="${message}" source="Orchestrator" log="Application" />
<logger name="*" minlevel="Info" writeTo="eventLog" />
作业计划程序生成的日志具有单独的目标和记录器:
<target xsi:type="EventLog" name="eventLogQuartz" layout="[Quartz] ${message} ${onexception: ${exception:format=tostring}}"
source="Orchestrator" log="Application" />
<logger name="Orchestrator.Quartz.*" minlevel="Info" writeTo="eventLogQuartz" />
示例:
无法创建 Quartz 作业
业务规则和其他验证规则生成的日志具有单独的目标和记录器:
<target xsi:type="EventLog" name="businessExceptionEventLog" layout="${message}${onexception:${exception:format=tostring:maxInnerExceptionLevel=5:innerFormat=tostring}}"
source="Orchestrator.BusinessException" log="Application" />
<logger name="BusinessException.*" minlevel="Info" writeTo="businessExceptionEventLog" final="true" />
在以下情况下,这些类型的错误消息会记录在事件查看器中:
-
验证问题,例如:
用户名/电子邮件地址或密码无效。
计算机名称 DOC 已被占用
-
业务冲突,例如:
许可证已过期!
浮动机器人的会话已在计算机 ROQADOCS06 上处于活动状态!
对于此流程,机器人已经有待定作业。
-
未找到异常,例如:
队列名称 1 不存在。
Orchestrator 执行日志
linkUiPath.Orchestrator.dll.config
文件的 <nlog>
一节中所指定。
Orchestrator 执行日志的目标
默认情况下,所有机器人日志都发送到默认 Orchestrator 数据库的“日志”表,UiPath Orchestrator 还将其他信息存储在该数据库中。
UiPath.Orchestrator.dll.config
文件的 target xsi:type="Database" connectionString="..."
部分中进行配置,选择将机器人日志发送到其他数据库。
“日志”页面显示默认数据库的“日志”表中的信息。因此,如果此部分不存在,或者日志保存到其他数据库中,则页面为空。所有参数都应符合表格架构,如下所示:
<target xsi:type="Database" name="database" connectionString="${ui-connection-strings:item=Default}" keepConnection="true">
<commandText>
insert into dbo.Logs (OrganizationUnitId, TenantId, TimeStamp, Level, WindowsIdentity, ProcessName, JobKey, Message, RawMessage)
values (@organizationUnitId, @tenantId, @timeStamp, @level, @windowsIdentity, @processName, @jobId, @message, @rawMessage)
</commandText>
<parameter name="@organizationUnitId" layout="${event-properties:item=organizationUnitId}" />
<parameter name="@tenantId" layout="${event-properties:item=tenantId}" />
<parameter name="@timeStamp" layout="${date}" />
<parameter name="@level" layout="${event-properties:item=levelOrdinal}" />
<parameter name="@windowsIdentity" layout="${event-properties:item=windowsIdentity}" />
<parameter name="@processName" layout="${event-properties:item=processName}" />
<parameter name="@jobId" layout="${event-properties:item=jobId}" />
<parameter name="@message" layout="${message}" />
<parameter name="@rawMessage" layout="${event-properties:item=rawMessage}" />
</target>
<logger name="Robot.*" writeTo="database" final="true" />
<target xsi:type="Database" name="database" connectionString="${ui-connection-strings:item=Default}" keepConnection="true">
<commandText>
insert into dbo.Logs (OrganizationUnitId, TenantId, TimeStamp, Level, WindowsIdentity, ProcessName, JobKey, Message, RawMessage)
values (@organizationUnitId, @tenantId, @timeStamp, @level, @windowsIdentity, @processName, @jobId, @message, @rawMessage)
</commandText>
<parameter name="@organizationUnitId" layout="${event-properties:item=organizationUnitId}" />
<parameter name="@tenantId" layout="${event-properties:item=tenantId}" />
<parameter name="@timeStamp" layout="${date}" />
<parameter name="@level" layout="${event-properties:item=levelOrdinal}" />
<parameter name="@windowsIdentity" layout="${event-properties:item=windowsIdentity}" />
<parameter name="@processName" layout="${event-properties:item=processName}" />
<parameter name="@jobId" layout="${event-properties:item=jobId}" />
<parameter name="@message" layout="${message}" />
<parameter name="@rawMessage" layout="${event-properties:item=rawMessage}" />
</target>
<logger name="Robot.*" writeTo="database" final="true" />
UiPath.Orchestrator.dll.config
文件添加到日志中。可在此处找到可用目标列表。
升级 Orchestrator 时,系统会删除并重新创建 Nlog 目标,如下所示:
- 升级到 2022.4 后, Nlog 数据库目标将恢复为其默认值。
- 升级到 2022.10 后, Nlog 数据库目标将被删除,并替换为新的和改进的目标。
database
、monitoring
和 insightsRobotLogs
目标。
CREATE NONCLUSTERED INDEX [IX_Search] ON [dbo].[Logs]
(
[TenantId] ASC,
[OrganizationUnitId] ASC,
[Level] ASC,
[TimeStamp] DESC
)WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Search] ON [dbo].[Logs]
(
[TenantId] ASC,
[OrganizationUnitId] ASC,
[Level] ASC,
[TimeStamp] DESC
)WITH (STATISTICS_NORECOMPUTE = OFF, DROP_EXISTING = OFF, ONLINE = OFF, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
Elasticsearch 服务器
<nlog>
节中指定的目标进行配置。
对于低于 Elasticsearch 8.0 的版本:
<target name="robotElasticBuffer" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticSearch" name="robotElastic" uri="uritoelasticsearchnode" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="logEvent" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,organizationId,indexName" />
</target>
</target>
<target name="robotElasticBuffer" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticSearch" name="robotElastic" uri="uritoelasticsearchnode" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="logEvent" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,organizationId,indexName" />
</target>
</target>
对于 Elasticsearch 8.0 及更高版本:
<target name="robotElasticBuffer" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticSearch" name="robotElastic" uri="uritoelasticsearchnode" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="" enableApiVersioningHeader="true" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,organizationId,indexName" />
</target>
</target>
<target name="robotElasticBuffer" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticSearch" name="robotElastic" uri="uritoelasticsearchnode" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="" enableApiVersioningHeader="true" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,organizationId,indexName" />
</target>
</target>
为了使 Elasticsearch 8.0 及更高版本正常工作,请按如下方式设置这些参数:
documentType
为空。- 将
enableApiVersioningHeader
设置为true
。
X-PACK 身份验证
用户名和密码身份验证
要启用通过用户名和密码进行的身份验证,您需要执行以下步骤:
- 配置 Elasticsearch 服务器,如下所示:
- 将
xpack.security.enabled
设置添加到elasticsearch.yml
配置文件。 -
设置用户名和密码。
有关更多详细信息,请参阅 Elasticsearch 文档。
- 将
- 配置 Orchestrator 的
UiPath.Orchestrator.dll.config
文件,如下所示:
- 选项 1:如果不使用 NLog 目标,则需要配置以下参数:
Logs.Elasticsearch.Username
和Logs.Elasticsearch.Password
。 确保其值与步骤 1 中的 Elasticsearch 设置匹配。 -
选项 2:如果将
Logs.RobotLogs.ReadTarget
设置为 NLog 目标(例如robotElasticBuffer
),并且未指定Logs.Elasticsearch.Nodes
设置,请通过添加以下内容来配置目标:requireAuth="true" username="XPACKuser" password="p@$$w0rd"
。 确保这些参数值与步骤 1 中的 Elasticsearch 设置匹配。有关这些参数的更多信息,请参阅 UiPath.Orchestrator.dll.config 页面。
有关配置示例,请参见以下内容:
<target name="robotElasticBuffer" xsi:type="BufferingWrapper" flushTimeout="5000"> <target xsi:type="ElasticSearch" name="robotElastic" uri="" requireAuth="true" username="XPACKusername" password="p@$$w0rd" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="logEvent" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,indexName" /> </target>
<target name="robotElasticBuffer" xsi:type="BufferingWrapper" flushTimeout="5000"> <target xsi:type="ElasticSearch" name="robotElastic" uri="" requireAuth="true" username="XPACKusername" password="p@$$w0rd" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="logEvent" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,indexName" /> </target> - 选项 3:如果
Logs.RobotLogs.ReadTarget
设置为 NLog 目标(例如robotElasticBuffer
),并且通过Logs.Elasticsearch.Nodes
设置指定了 Elasticsearch 节点,则需要显式配置它(因为它会覆盖 NLog 目标设置) ,并确保同时添加以下内容:requireAuth="true" username="XPACKuser" password="p@$$w0rd"
。 确保这些参数值与步骤 1 中的 Elasticsearch 设置匹配。
OAuth 2 身份验证
要切换到 OAuth2 作为 Elasticsearch 的身份验证方法,您需要执行以下步骤。 请注意,您需要提供当前凭据才能切换到此基于令牌的身份验证方法。
- 配置 Elasticsearch 服务器,如下所示:
一个。为传输层启用 TLS (HTTPS)。
湾更新elasticsearch.yml
配置文件中的以下设置:xpack.security.authc.token.enabled: true
xpack.security.enabled: true
-
xpack.security.authc.token.timeout
- 此设置为可选设置,用于控制令牌的有效期。 默认情况下,其值设置为 20 分钟。有关更多详细信息,请参阅 Elasticsearch 文档。
- 更新 Orchestrator 的
UiPath.Orchestrator.dll.config
文件中的以下参数,以反映您在步骤 1 中选择的设置。Logs.Elasticsearch.TlsEnabled = ”true”
- 默认情况下,此参数设置为true
,并确保启用 TLC (HTTPS)。Logs.Elasticsearch.OAuthEnabled = ”true”
- 默认情况下,此参数设置为false
。 有关更多信息,请参阅Logs.Elasticsearch.OAuthEnabled
。-
Logs.Elasticsearch.OAuthExpireInSeconds = ”1200”
- 此参数是可选参数,除非在 Elasticsearchxpack.security.authc.token.timeout
设置中更改了1200
的默认值。 此参数的值必须与 Elasticsearch 配置中的值相同。 有关更多信息,请参阅Logs.Elasticsearch.OAuthExpireInSeconds
。注意: 前两个步骤可帮助您配置基于令牌的身份验证机制以读取日志。 如果您使用 NLog,则需要执行其他步骤。
- 要为 Nlog 启用 OAuth2,请确保在 Orchestrator 的
UiPath.Orchestrator.dll.config
文件中也配置以下参数。 请注意,您必须填写 用户名和密码 以在 Elasticsearch 中进行身份验证,因为初始令牌是根据这些凭据生成的。-
重要提示: 如果
Logs.RobotLogs.ReadTarget
设置为 NLog 目标(例如robotElasticBuffer
),并且未指定Logs.Elasticsearch.Nodes
设置,则从 NLog 目标配置中填充Logs.Elasticsearch.OAuthEnabled
。 相同的逻辑适用于用户名和密码。
-
API 密钥身份验证
- 请按照 以下步骤生成 API 密钥。
- 将 API 密钥作为密码存储在 Azure 密钥保管库中。
- 使用您的数据配置以下 Nlog 目标参数,从而在 Orchestrator 和允许检索密钥的密钥保险库之间创建连接:
apiKeyEnabled="true" apiKeyProvider="AzureKeyVault" apiKeySecretName="<SecretName>" azureKeyVaultUri="<KeyVaultUri>" azureKeyVaultDirectoryId="<KeyVaultDirectoryId>" azureKeyVaultClientId="<KeyVaultClientId>" azureKeyVaultCertificateThumbprint="<KeyVaultCertificateThumbprint>" azureKeyVaultCertificateStoreLocation="CurrentUser/LocalMachine"
apiKeyEnabled="true" apiKeyProvider="AzureKeyVault" apiKeySecretName="<SecretName>" azureKeyVaultUri="<KeyVaultUri>" azureKeyVaultDirectoryId="<KeyVaultDirectoryId>" azureKeyVaultClientId="<KeyVaultClientId>" azureKeyVaultCertificateThumbprint="<KeyVaultCertificateThumbprint>" azureKeyVaultCertificateStoreLocation="CurrentUser/LocalMachine"以下参数需要使用您的值进行编辑:
-
<SecretName>
- 您在密钥保险库中为 API 密钥设置的名称 -
<KeyVaultUri>
- 密钥保险库的 URI -
<KeyVaultDirectoryId>
- 您的密钥保险库目录 ID -
<KeyVaultClientId>
- 您的密钥保险库客户端 ID -
<KeyVaultCertificateThumbprint>
- 密钥保险库证书的指纹 -
CurrentUser/LocalMachine
- 证书的存储位置
-
API 密钥过期时间
默认情况下,API 密钥不会过期,但您仍然可以选择为其设置过期日期。
如果您的 API 密钥设置为过期,则必须在过期日期之前生成一个新密钥并将其存储在密钥保险库中,以确保 Orchestrator 始终可以检索有效密钥。
Orchestrator 每 15 分钟从密钥保险库读取 API 密钥,因此这是传播新密钥之前可以预期的最大延迟量。