I am trying to send UiPath logs to ElasticSearch using Nlog

I am trying to send UiPath logs to ElasticSearch using Nlog. Here is my Nlog.config file.

<?xml version="1.0" encoding="utf-8" ?>
<!-- XSD manual extracted from package NLog.Schema: https://www.nuget.org/packages/NLog.Schema-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      internalLogFile="c:\temp\console-example-internal.log"
      internalLogLevel="Info" >
	<extensions>
		<add assembly="NLog.Targets.ElasticSearch" assemblyFile="NLog.Targets.ElasticSearch.dll" />
	</extensions>
	<targets>
		<target name="elastic" xsi:type="BufferingWrapper" flushTimeout="5000">
			<target 
				xsi:type="ElasticSearch" 
				uri="https://host:9200/"
			/>
		</target>
	</targets>
	<rules>
		<logger name="*" minlevel="Info" writeTo="elastic" />
	</rules>
</nlog>

I am getting this result.

Error ElasticSearch: Failed to send log messages. Status= Uri=https://host:9200/_bulk DebugInformation=Invalid NEST response built from a unsuccessful () low level call on POST: /_bulk
# Invalid Bulk items:
# Audit trail of this API call:
 - [1] PingFailure: Node: https://host:9200/ Exception: ArgumentOutOfRangeException Took: 00:00:00.0176002
# OriginalException: Elasticsearch.Net.ElasticsearchClientException: Failed to ping the specified node. Call: unknown resource
 ---> Elasticsearch.Net.PipelineException: Failed to ping the specified node.
 ---> System.ArgumentOutOfRangeException: The specified value must be greater than 0. (Parameter 'value')
Actual value was -1.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Connection\HttpWebRequestConnection.cs:line 76
   at Elasticsearch.Net.RequestPipeline.Ping(Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 383
   --- End of inner exception stack trace ---
   at Elasticsearch.Net.RequestPipeline.Ping(Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 396
   at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Transport.cs:line 236
   at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Transport.cs:line 76
   --- End of inner exception stack trace ---
# Audit exception in step 1 PingFailure:
System.ArgumentOutOfRangeException: The specified value must be greater than 0. (Parameter 'value')
Actual value was -1.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Connection\HttpWebRequestConnection.cs:line 76
   at Elasticsearch.Net.RequestPipeline.Ping(Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 383
# Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
# Response:
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
 Exception: Elasticsearch.Net.ElasticsearchClientException: Failed to ping the specified node. Call: unknown resource
 ---> Elasticsearch.Net.PipelineException: Failed to ping the specified node.
 ---> System.ArgumentOutOfRangeException: The specified value must be greater than 0. (Parameter 'value')
Actual value was -1.
   at System.Net.HttpWebRequest.GetResponse()
   at Elasticsearch.Net.HttpWebRequestConnection.Request[TResponse](RequestData requestData) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Connection\HttpWebRequestConnection.cs:line 76
   at Elasticsearch.Net.RequestPipeline.Ping(Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 383
   --- End of inner exception stack trace ---
   at Elasticsearch.Net.RequestPipeline.Ping(Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Pipeline\RequestPipeline.cs:line 396
   at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Transport.cs:line 236
   at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters) in E:\Projects\Elastic\elasticsearch-net-copy\src\Elasticsearch.Net\Transport\Transport.cs:line 76
   --- End of inner exception stack trace ---

I have access from my computer’s IP. I don’t understand what the error could be.

Hi @Sergej_Sysoev

Check out the thread

Regards

Thanks, but that’s not really what I need. I don’t use the orchestrator. I want to send logs from the local machine directly to ElasticSearch. I tried doing the same thing through Visual Studio 2022 - everything works with the same config. But for some reason I get an error when I try to use UiPath Studio.