Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing a parenthesis at ECS node.js logging #3027

Open
liu-xiao-guo opened this issue Jul 8, 2024 · 0 comments
Open

Missing a parenthesis at ECS node.js logging #3027

liu-xiao-guo opened this issue Jul 8, 2024 · 0 comments

Comments

@liu-xiao-guo
Copy link

At the link https://www.elastic.co/guide/en/ecs-logging/nodejs/current/pino.html#pino-ref, there is a missing "(" in the code:

image

The correct code should be:

const http = require('http');
const { ecsFormat } = require('@elastic/ecs-pino-format');
const pino = require('pino');

const log = pino(ecsFormat({ convertReqRes: true })); 

const server = http.createServer(function handler (req, res) {
  res.setHeader('Foo', 'Bar');
  res.end('ok');
  log.info({ req, res }, 'handled request'); 
});

server.listen(3000, () => {
  log.info('listening at http://localhost:3000');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant