We have an aspnetcore application and we have a healthcheck that makes request to an endpoint every x seconds. Our API is using serilog, logging level information which log each request made to the API.
My question is: How can we filter to exclude from log requests made to a specific endpoint?
Just for example this is our logging code today:
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
.Enrich.FromLogContext()
.Filter.ByExcluding(c => c.MessageTemplate.Text.Contains("Request"))
.WriteTo.Console()
.WriteTo.RollingFile(hostingContext.Configuration["log-path"]))
.Build();
Today we can only filter all requests. How do we filter a specific endpoint request?