ECS Console Logger for Microsoft.Extensions.Logging. Writes Elastic Common Schema (ECS), with semantic logging of structured data from message and scope values to console out, use filebeat/Elastic-Agent to send these to Elastic
$ dotnet add package Elastic.Extensions.Logging.ConsoleThis package includes formatters and extension methods for Microsoft.Extensions.Logging.Console to make it easy to write ECS formatted logs to consoleoutput.
May be used with Elastic.Extensions.Logging to write ECS documents directly to Elasticsearch / Elastic Cloud.
The console logging provider and formatter can be set up using a simple extension method.
.ConfigureLogging((_, loggingBuilder) => loggingBuilder.AddEcsConsole())
Or indirectly using the types provided in this package:
.ConfigureLogging((_, loggingBuilder) =>
{
loggingBuilder.AddConsole(c=> c.FormatterName = "ecs");
loggingBuilder.AddConsoleFormatter<EcsConsoleFormatter, EcsConsoleFormatterOptions>();
})