I have installed the NuGet package Elastic.Apm.SerilogEnricher
to my asp.net core web app (mvc) project. My application is using Serilog to write logs directly to elasticsearch. When I added this NuGet package it tells me that it will include 3 properties. 1) ElasticApmTraceId
2) ElasticApmTransactionId
3) ElasticApmSpanId
. On my application I added .Enrich.WithElasticApmCorrelationInfo()
inside of my .UseSerilog()
, I run the application perform operations on it. Then when I go to the CLI in Kibana and do a DSL query search I get all the logs back, however when trying to search for ElasticApmSpanId
it is no where to be found. I only see ElasticApmTraceId
and ElasticApmTransactionId
. Am I using this package incorrectly?
Inside of my Program.cs
file:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog((context, configuration) =>
{
configuration.Enrich.FromLogContext()
.Enrich.WithElasticApmCorrelationInfo()
.Enrich.WithMachineName()
.WriteTo.Console()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(context.Configuration["ElasticConfiguration:Uri"]))
{
IndexFormat = $"{context.Configuration["ApplicationName"]}-logs-{context.HostingEnvironment.EnvironmentName?.ToLower().Replace(".", "-")}-{DateTime.UtcNow:yyyy-MM}",
AutoRegisterTemplate = true
})
.Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName)
.ReadFrom.Configuration(context.Configuration);
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseAllElasticApm();
When I try to search the entire logs for ElasticApmSpanId
: