0

I have this Pino transport with two targets:

const transport = pino.transport({
  targets: [
    { target: 'pino-elasticsearch', options: { /* ... */ } },
    { target: 'pino-pretty', options: { /* ... */ } },
  ],
});

And the logger:

import ecsFormat from '@elastic/ecs-pino-format';

const logger = pino(
  {
    level: 'info',
    ...ecsFormat(),
  },
  transport
);

Problems:

  1. Using ...ecsFormat() with both targets stops logging completely. It works if I remove one target or remove ecsFormat().
  2. I only want ECS format for Elasticsearch logs, not console logs. Examples I found apply it globally.

Question: How can I apply ECS formatting only to the Elasticsearch target?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.