1

I have a ballpark idea of how the ELK stack works. I read that by default, standard output is captured and that output will make its way to the Elasticsearch repository. If I post something to stdout, that content piece will be when visualized with Kibana in one field called "message".

So, besides the title which was anyway getting too long, here's the additional ask. How do I send a structured message, JSON I guess? How do I configure it? I read that it is possible, but I have some difficulties piecing it together. There's something about a JSON template that needs to be registered somewhere, but I lack a clear example.

  • Its is very normal to ship plain old logs to ELK. Our apps have very ordinary logs typical of a webserver not json. So you don’t need to perform any conversion of logs. With respect to what writes to L of ELK or the F of EFK then that has to be something that is able to read the logs which entirely down to how and where you are running the code. You need to research how to integrate ELK or EFK into your environment. – simbo1905 Aug 21 '19 at 7:54
1

How do I send a structured message?

If you want structured messages check out some of the recommended third party logging options. Some of these options have built-in support for Elasticsearch logging. For instance, Serilog provides a "sink" for putting logs directly into Elasticsearch.

How do I configure it in code?

These options all tie into the ILogger interface, so testing different logging frameworks should require very little code changes. However, the initial entry point of the application (e.g. Program.cs) will need to be configured to use the 3rd party logger. The official .net core docs go over this in detail.

How do I configure it for Elasticsearch?

This will depend on the logger. The appsettings.json will most likely be where you configure the .net core application's connection to Elasticsearch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.