0

I currently have a .NET console applications where I sink my logging to ELK using the partial complete method below:

private static LoggerConfiguration AddElasticSearch(this LoggerConfiguration config, IConfigurationRoot configuration,
     string keyIdentifier)
{
     var ignoreSslCerts = IgnoreRemoteServerCertificates(configuration);
     var elasticSearchUri = ElasticUrl(configuration);
     var elasticCredentials = ElasticBasicCredentials(configuration);

     if (string.IsNullOrEmpty(elasticSearchUri))
     {
         Console.WriteLine("Elastic search has not been configured - The elastic URL is null or empty");
         return config;
     }

     config.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(elasticSearchUri)) 
     ........
     .......
}

I would like to use a sink to batch the data to the web API and then send into ELK via a sink similar to below. I want to do this so that I do not need to generate API keys for ELK and the console applications do not need to know URL for elastic etc. Also if I want to change the logging system; I can just change it in one place on the backend.

I suppose I am trying to create a proxy into ELK using ASP.NET Core.

Anyone come across any examples of documents of doing this?

Thanks

1 Answer 1

0

The best way to do this is to use

Serilog.Sinks.Http

A good example or the question has been answered on the below links:

Post Serilog logs to Rest api

https://github.com/FantasticFiasco/serilog-sinks-http-sample-dotnet-core

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.