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:
- Using ...ecsFormat() with both targets stops logging completely. It works if I remove one target or remove ecsFormat().
- 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?