Using Elastic.Apm.NetCoreAll with Serilog.AspNetCore

Kibana version: 7.16.3

Elasticsearch version: 7.16.3

APM Server version: 7.16.3

I'm having an issue when trying to use the Elastic APM performance monitoring while also sending logs to Elastic Search. I've reproduced the issue using a minimal example that I've adapted from another post on this forum (GitHub - aims519/ElasticApmSerilogMinimalExample). If I just use Elastic APM by itself I see errors appear in Kibana as expected, e.g.

If I then try to add Serilog back into the mix, which includes Elastic APM correlation info, I can see logs in Kibana fine, but errors are no longer captured as before


Steps to reproduce:

  1. Clone minimal example from GitHub
  2. Update appsettings.Development.json with appropriate URLS and credentials for elastic search and APM server
  3. Run the application. You should see logs but no errors captured in Kibana
  4. Comment out .UseSerilog from Program.cs. You should then see no logs in Kibana, but should see errors logged.

Any help would be greatly appreciated!