Configure OpenSearch Sink For Serilog

84 views Asked by At

App is crashing with error code 139. Error in Serilog Uri Configuration


What is actually Happening.

"nodeUris": "http://localhost:9200;"
If I remove the above line in appsettings.json App works fine. As it takes http://localhost:9200 as default uri. But if I keep it. App crashes with error code 139


OpenSearch server is running locally on docker.

docker run -d \
-p 9200:9200 -p 9600:9600 \
-e "discovery.type=single-node" \
-e "DISABLE_SECURITY_PLUGIN=true" \
opensearchproject/opensearch

appsettings.json :

  "Serilog": {
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "OpenSearch",
        "Args": {
          "nodeUris": "http://localhost:9200;"
        }
      }
    ]
  }

Program.cs :

Host.CreateDefaultBuilder(args)
  .ConfigureWebHostDefaults(webBuilder => {webBuilder.UseStartup<Startup>();})
  .UseSerilog( (context, config) => {
    config.ReadFrom.Configuration(context.Configuration);
  })
  .Build()
  .Run();

I think I have all required packages.

   Top-level Package                         Requested   Resolved
   > Microsoft.Extensions.Configuration      8.0.0       8.0.0
   > NHibernate                              5.4.6       5.4.6
   > Serilog.AspNetCore                      7.0.0       7.0.0
   > Serilog.Enrichers.Environment           2.3.0       2.3.0
   > Serilog.Formatting.OpenSearch           1.0.0       1.0.0
   > Serilog.Settings.Configuration          7.0.1       7.0.1
   > Serilog.Sinks.Console                   5.0.0       5.0.0
   > Serilog.Sinks.File                      5.0.0       5.0.0
   > Serilog.Sinks.OpenSearch                1.0.0       1.0.0
0

There are 0 answers