Logs not sent when elastic-apm-node is enabled, even with ECSformat

Hey everyone,

First, thanks for your work !

I am trying to build a NestJS application and I would like to push logs to elasticsearch. The app's deployment does not allow me to use filebeat so I need to push logs directly to ES.
I am using Elasticsearch Cloud Serverless (if that matters).

since it's a combination of libraries maybe that's not the right place, just tell me and sorry if that's the case.

What's happening ?

Demo project: tell-ia/nestjs-apm-es

  • Configure and start
    bash npm run start
  • open http://localhost:3000 in a browser tab
  • In Elasticsearch you can observe both logs from app.controller.ts and app.service.ts are visible and indexed into Elasticsearch.
  1. Now, enable APM
  • Edit .env or set APM_ENABLED=true
  • open http://localhost:3000 in a browser tab
  • In Elasticsearch you can observe both logs from app.controller.ts and app.service.ts are NOT INDEXED into Elasticsearch.

would you have any ideas ?

Things to note:

  • currently i'm pushing to a something-logsindex and I created a datastream for that. this datastream is configured like this :

I'm not sure of this setting.

Have a good day !