UiPath Documentation
automation-suite
2024.10
false

Automation Suite on EKS/AKS installation guide

Configuring NLog

Adding NLog extensions

Orchestrator loads the following extensions by default, so you do not need to include them in the folder or the NLog configuration:

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

Only Linux-compatible extensions can be used in this setup, so make sure that your chosen NLog extension abides by this rule.

To make the extension available for use, it must uploaded to the cluster storage. The uipathctl command line tool can do this via the uipathctl config orchestrator upload command:

uipathctl config orchestrator upload --nlog-extensions-directory /path/to/extensions/directory
uipathctl config orchestrator upload --nlog-extensions-directory /path/to/extensions/directory

If you use an external storage configuration at the cluster level, you must indicate this by including the --is-external-storage parameter.

Advanced NLog configuration

Creating the advanced NLog configuration

  1. Create the nlog.config.json file containing the standard sections: extensions, targets and rules.

    The extensions section is an array of items that specify the extension assemblies, via assemblyFile, and the path of the assembly.

    If custom NLog plugins were loaded (as described in the Adding NLog extensions section), they will be referenced in the extensions section.

  2. Configure the target and rule in the nlog.config.json file.

  3. Apply the nlog.config.json file using the uipathctl command line tool:

    uipathctl config orchestrator update-config --nlog-config nlog.custom.json
    uipathctl config orchestrator update-config --nlog-config nlog.custom.json
    
    Important:

    This action overwrites the existing custom NLog configuration. You can check what the existing configuration is by using this command:

    uipathctl config orchestrator get-config --nlog-config
    uipathctl config orchestrator get-config --nlog-config
    

    Example nlog.config.json file that writes logs to Azure Blob:

    {   "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" } }
        }
    }
    

    Example nlog.config.json file that writes robot logs to Splunk:

    {
        "Nlog": {
            "extensions": [
                { "assemblyFile": "NLog.Targets.Splunk.dll" },
                { "assembly": "UiPath.Orchestrator.Logs.DatabaseBulk.NLogTarget" }
            ],
            "targets": {
                "Splunk": {
                    "type": "AsyncWrapper",
                    "overflowAction": "Discard",
                    "queueLimit": 10000,
                    "batchSize": 200,
                    "timeToSleepBetweenBatches": 1,
                    "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": "",
                        "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": "AsyncWrapper",
                    "overflowAction": "Discard",
                    "queueLimit": 10000,
                    "batchSize": 200,
                    "timeToSleepBetweenBatches": 1,
                    "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": "",
                        "proxyPassword": ""
                    }
                }
            },
            "rules": {
                "20_Robot_Primary": { "writeTo": "Splunk,database,insightsRobotLogs" }
            }
        }
    }
    

Sizing the Splunk queueLimit

The queue absorbs Splunk backlog during slowdowns. Size it to your peak throughput, not your average:

queueLimit = peak_logs_per_sec × acceptable_backlog_seconds
queueLimit = peak_logs_per_sec × acceptable_backlog_seconds
DeploymentPeak rateBacklog tolerancequeueLimit
Small~10 logs/sec60 s600
Medium~35 logs/sec300 s10000
Large~200 logs/sec60 s12000

Best practices for Splunk targets

  • Use overflowAction: Discard for secondary targets. External log targets such as Splunk are typically analytics or observability destinations, the Orchestrator database is the source of truth. If the external target cannot keep up, dropping its copy is preferable to blocking application threads.
  • Reserve overflowAction: Block for targets where loss is not acceptable. Block prevents event loss but does not prevent blocking. When the queue fills under sustained load it reverts to the same thread-blocking behavior as BufferingWrapper. Only use it when the external target is a compliance or audit requirement, and size queueLimit generously to match peak throughput.
  • Always keep database in the writeTo rule alongside any external target. This ensures no robot log is permanently lost regardless of the availability or performance of the external target.
  • Flush before shutdown. AsyncWrapper holds events in an in-memory queue. Ensure NLog targets are flushed on graceful shutdown to avoid losing the tail of the queue when the process exits.

Updating the advanced NLog configuration

The uipathctl commands needed for updating the NLog configuration are:

  • uipathctl config orchestrator get-config --nlog-config - Exports the current configuration in a key-value pair json file, ready for editing.
  • uipathctl config orchestrator update-config --nlog-config nlog.config.json - Updates the configuration with your changes.
  1. Export the current custom NLog configuration to a json file using this command:
    uipathctl config orchestrator get-config --nlog-config > nlog.config.json
    uipathctl config orchestrator get-config --nlog-config > nlog.config.json
    
  2. Edit the exported nlog.config.json file as needed. You can add, remove, or change any of its settings.
    Note:

    You must export the file again every time you need to make a change, since the update overwrites all NLog settings.

  3. Update the NLog configuration using this command:
    uipathctl config orchestrator update-config --nlog-config nlog.config.json
    orchestrator config updated
    uipathctl config orchestrator update-config --nlog-config nlog.config.json
    orchestrator config updated
    

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated