Automation Suite
2023.10
バナーの背景画像
Linux の Automation Suite のインストール ガイド
最終更新日 2024年4月19日

NLog を構成する

NLog 拡張機能を追加する

以下の拡張機能が Orchestrator によって既定で読み込まれるため、フォルダーまたは NLog の構成にこれらの拡張機能を含める必要はありません。

  • NLog.Targets.ElasticSearch

  • UiPath.Orchestrator.Logs.Elasticsearch

  • Microsoft.ApplicationInsights.NLogTarget

  • NLog.Extensions.AzureEventHub

この設定で使用できるのは Linux 対応の拡張機能のみであるため、選択した NLog 拡張機能がこのルールに準拠していることを確認してください。

拡張機能を使用できるようにするには、クラスター ストレージに拡張機能をアップロードする必要があります。Orchestrator 構成ツールでは、-n|--nlog-extensions-folder パラメーターを使用してこれを行うことができます。
./orchestrator-configurator.sh -n nlogextensions./orchestrator-configurator.sh -n nlogextensions
外部ストレージ構成をクラスター レベルで使用する場合は、それを示すために --use-external-storage パラメーターを含める必要があります。

NLog の高度な設定

  1. 拡張機能、ターゲット、ルールといった標準的なセクションを含む nlog.config.json ファイルを作成します。
    拡張機能セクションは、assemblyFile を使用して拡張機能アセンブリを指定する項目の配列と、アセンブリのパスです。
    カスタムの NLog プラグインが読み込まれた場合 (「NLog 拡張機能を追加する」のセクションを参照)、そのプラグインは extensions セクションで参照されます。
  2. nlog.config.json ファイルでターゲットとルールを構成します。
  3. Orchestrator 構成ツールを使用して、nlog.config.json ファイルを適用します。
    ./orchestrator-configurator.sh -l nlog.custom.config./orchestrator-configurator.sh -l nlog.custom.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 の高度な設定

Was this page helpful?

サポートを受ける
RPA について学ぶ - オートメーション コース
UiPath コミュニティ フォーラム
UiPath ロゴ (白)
信頼とセキュリティ
© 2005-2024 UiPath. All rights reserved.