I've gotten Serilog writing to a rolling file okay and started implementing a connection to a Docker-based ElasticSearch instance. However, I am having connection issues.
To start, my application is running locally and there's two big take-aways:
However, when I look at the output of Serilog.Debugging.SelfLog.Enable(msg => Debug.WriteLine(msg));
, I see there's some sort of connection issue with Elastic:
Caught exception while preforming bulk operation to Elasticsearch: Elasticsearch.Net.ElasticsearchClientException: Maximum timeout reached while retrying request
My appsettings.json (yes, I am configuring through json and not code):
"Serilog": {
"Using": ["Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.ElasticSearch"],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"Enrich": ["FromLogContext", "WithExceptionDetails"],
"WriteTo": [
{ "Name": "Console" },
{ "Name": "Debug" },
{
"Name": "File",
"Args": {
"path": "%LogDir%\\someserverpath.xyz.com\\log-.txt",
"rollingInterval": "Day",
"shared": true
}
},
{
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://sxdockertst1:9200",
"indexFormat": "imaging4cast-index-{0:yyyy.MM}",
"emitEventFailure": "WriteToSelfLog",
"autoRegisterTemplate": true
}
}
],
"Properties": {
"Application": "xyz.yyy.Imaging4CastApi"
}
},
I feel like it's getting rudimentary connection because, otherwise, how else would the index have been created? There's no auth on the elastic server, either. But actually pushing a log message doesn't appear to be working...
I'm at a loss here...
Okay, so I figured this out.
The reason it was not posting messages was because the hard drive (technically, var
on the docker host) was full. I had to clean up about 15GB of logs and messages in var
.
Then, I needed to run this command to get Elastic out of Read-only mode (I quickly encountered an issue where I couldn't created indexes in Kibana for dashboarding and it was because Elastic went into RO mode):
curl -XPUT -H "Content-Type: application/json" http://sxdockertst1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.