automation-suite
2024.10
true
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

OpenShift 上的 Automation Suite 安装指南

上次更新日期 2025年3月17日

配置 NLog

添加 NLog 扩展程序

Orchestrator 默认加载以下扩展程序,因此您无需将其包含在文件夹或 NLog 配置中:

  • NLog.Targets.ElasticSearch
  • UiPath.Orchestrator.Logs.Elasticsearch
  • Microsoft.ApplicationInsights.NLogTarget
  • NLog.Extensions.AzureEventHub

在此设置中,只能使用与 Linux 兼容的扩展程序,因此请确保您选择的 NLog 扩展程序遵守此规则。

要使扩展程序可用,必须将其上传到集群存储。 uipathctl命令行工具可以通过uipathctl config orchestrator upload命令执行此操作:
uipathctl config orchestrator upload -- nlog - extensions - directory / path / to / extensions / directoryuipathctl config orchestrator upload --nlog-extensions-directory /path/to/extensions/directory
如果在集群级别使用外部存储配置,则必须通过包含 --is-external-storage 参数来指明这一点。

高级 NLog 配置

创建高级 NLog 配置

  1. 创建包含以下标准部分的 nlog.config.json 文件:扩展程序、目标和规则。
    扩展程序部分是一个项目数组,通过 assemblyFile 和程序集的路径指定扩展程序集。
    如果加载了自定义 nlog 插件(如添加 NLog 扩展程序部分中所述),则将在 extensions 部分中引用这些插件。
  2. nlog.config.json 文件中配置目标和规则。
  3. 使用uipathctl命令行工具应用nlog.config.json文件:
    uipathctl config orchestrator update-config --nlog-config nlog.custom.jsonuipathctl config orchestrator update-config --nlog-config nlog.custom.json
    重要提示:此操作将覆盖现有的自定义 NLog 配置。 您可以使用以下命令来检查现有配置:
    uipathctl config orchestrator get-config --nlog-configuipathctl config orchestrator get-config --nlog-config
    将日志写入 Azure Blob 的 nlog.config.json 文件示例:
    {   "NLog": {
            "extensions": [
                { "assemblyFile": "NLog.Extensions.AzureBlobStorage.dll" }
            ],
            "targets": {
                "azureBlob": {
                    "type": "AzureBlobStorage",
                    "connectionString": "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=key;EndpointSuffix=core.windows.net",
                    "container": "orchestratorlogs",
                    "blobName": "${date:format=yyyy-MM-dd hh.mm}",
                    "layout": {
                      "type": "JsonLayout",
                      "includeAllProperties": true,
                      "Attributes": [
                        {"name": "ts","layout": "${longdate}"},
                        {"name": "level","layout": "${level:upperCase=true}"},
                        {"name": "logger","layout": "${logger}"},
                        {"name": "message","layout": "${message}"},
                        {"name": "exception","layout": "${onexception:${ui-pretty-exception}}"}
                      ]
                    }
                }
            },
            "rules": { "70_Final": { "writeTo": "stdout,azureBlob" } }
        }
    }{   "NLog": {
            "extensions": [
                { "assemblyFile": "NLog.Extensions.AzureBlobStorage.dll" }
            ],
            "targets": {
                "azureBlob": {
                    "type": "AzureBlobStorage",
                    "connectionString": "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=key;EndpointSuffix=core.windows.net",
                    "container": "orchestratorlogs",
                    "blobName": "${date:format=yyyy-MM-dd hh.mm}",
                    "layout": {
                      "type": "JsonLayout",
                      "includeAllProperties": true,
                      "Attributes": [
                        {"name": "ts","layout": "${longdate}"},
                        {"name": "level","layout": "${level:upperCase=true}"},
                        {"name": "logger","layout": "${logger}"},
                        {"name": "message","layout": "${message}"},
                        {"name": "exception","layout": "${onexception:${ui-pretty-exception}}"}
                      ]
                    }
                }
            },
            "rules": { "70_Final": { "writeTo": "stdout,azureBlob" } }
        }
    }
    将机器人日志写入 Splunk 的 nlog.config.json 文件示例:
    {
        "Nlog": {
            "extensions": [
                { "assemblyFile": "NLog.Targets.Splunk.dll" },
                { "assembly": "UiPath.Orchestrator.Logs.DatabaseBulk.NLogTarget" }
            ],
            "targets": {
                "Splunk": {
                    "type": "BufferingWrapper",
                    "flushTimeout": 5000,
                    "target": {
                        "type": "SplunkHttpEventCollector",
                        "serverUrl": "http://splunk.example.com",
                        "token": "splunk-token",
                        "channel": "",
                        "source": "${logger}",
                        "sourceType": "_json",
                        "index": "uipath",
                        "retriesOnError": "0",
                        "batchSizeBytes": "0",
                        "batchSizeCount": "0",
                        "includeEventProperties": "true",
                        "includePositionalParameters": "true",
                        "includeMdlc": "true",
                        "maxConnectionsPerServer": "10",
                        "ignoreSslErrors": "false",
                        "useProxy": "false",
                        "proxyUrl": "",
                        "proxyUser": "",
                        "proxyPassword": ""
                    }
                }
            },
            "rules": {
                "20_Robot_Primary": { "writeTo": "Splunk,database,insightsRobotLogs" }
            }
        }
    }{
        "Nlog": {
            "extensions": [
                { "assemblyFile": "NLog.Targets.Splunk.dll" },
                { "assembly": "UiPath.Orchestrator.Logs.DatabaseBulk.NLogTarget" }
            ],
            "targets": {
                "Splunk": {
                    "type": "BufferingWrapper",
                    "flushTimeout": 5000,
                    "target": {
                        "type": "SplunkHttpEventCollector",
                        "serverUrl": "http://splunk.example.com",
                        "token": "splunk-token",
                        "channel": "",
                        "source": "${logger}",
                        "sourceType": "_json",
                        "index": "uipath",
                        "retriesOnError": "0",
                        "batchSizeBytes": "0",
                        "batchSizeCount": "0",
                        "includeEventProperties": "true",
                        "includePositionalParameters": "true",
                        "includeMdlc": "true",
                        "maxConnectionsPerServer": "10",
                        "ignoreSslErrors": "false",
                        "useProxy": "false",
                        "proxyUrl": "",
                        "proxyUser": "",
                        "proxyPassword": ""
                    }
                }
            },
            "rules": {
                "20_Robot_Primary": { "writeTo": "Splunk,database,insightsRobotLogs" }
            }
        }
    }

更新 NLog 高级配置

更新 NLog 配置所需的uipathctl命令为:
  • uipathctl config orchestrator get-config --nlog-config - 这将在键值对 json 文件中导出当前配置以供编辑。

    您可以阅读更多相关内容。

  • uipathctl config orchestrator update-config --nlog-config nlog.config.json - 这将使用您的更改来更新配置。

    您可以阅读更多相关内容。

  1. 使用以下命令将当前自定义 NLog 配置导出至 json 文件:
    uipathctl config orchestrator get-config --nlog-config > nlog.config.jsonuipathctl config orchestrator get-config --nlog-config > nlog.config.json
  2. 根据需要编辑导出的nlog.config.json文件。 您可以添加、删除或更改其任何设置。
    注意:每次需要进行更改时,都必须再次导出文件,因为更新会覆盖所有 NLog 设置。
  3. 使用以下命令更新 NLog 配置:
    uipathctl config orchestrator update-config --nlog-config nlog.config.json
    orchestrator config updateduipathctl config orchestrator update-config --nlog-config nlog.config.json
    orchestrator config updated
  • 添加 NLog 扩展程序
  • 高级 NLog 配置
  • 创建高级 NLog 配置
  • 更新 NLog 高级配置

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo White
信任与安全
© 2005-2025 UiPath。保留所有权利。