Closed jpges closed 6 years ago
This should work (appsettings.json):
{
"ConnectionStrings": {
"ElasticsearchUrl": "..."
},
"Logging": { }
}
It works fine. Thank you
It not works for me. Asp Net Core 3.0 (NLog.Targets.ElasticSearch 7.1.0) Error: "ElasticSearch: Failed to send log messages. status= Exception: Elasticsearch.Net.ElasticsearchClientException: Failed to ping the specified node.. Call: Status code unknown from: HEAD /"
@another-mi Please create new issue instead of disturbing old issues.
Please also include Nlog InternalLogger-output and your NLog.config in the new github-issue.
It is also a good idea to read the documentation (Notice NetCore-users should use ${configsetting}
):
https://github.com/markmcdowell/NLog.Targets.ElasticSearch/wiki#example-of-appsettingsjson
Dear all, I'm trying to get working the NLog with target to Elasticsearch in my asp.net web API application. I'm working with .net Core 2. I'm using two docker containers, one for my api and one for a ElasticSearch + Kibana.
My docker-compose.yml looks like:
I use NLog.Targets.ElasticSearch V 5.0.0 and NLog.Web.AspNerCore 4.5.2
If I use NLog.config below:
`
<target xsi:type="ElasticSearch"
connectionStringName="ElasticsearchUrl"
index="tcpymes-${date:format=yyyy.MM.dd}"
includeAllProperties="true"
requireAuth="true"
layout="NLOG.DESARROLLO: ${message}"
userName="user"
password="pwd"
documentType="application-nlog">
With this appsettings.json:
{ "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "None" } }, "ElasticsearchUrl": "http://elasticsearch-kibana:9200" }
Then target "elastic" doesn't work.
But if I use the Nlog.config below:
`
<target xsi:type="ElasticSearch"
uri="http://elasticsearch-kibana:9200"
index="tcpymes-${date:format=yyyy.MM.dd}"
includeAllProperties="true"
requireAuth="true"
layout="NLOG.DESARROLLO: ${message}"
userName="user"
password="pwd"
documentType="application-nlog">
Then target works allright.
Some idea?