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

Question: Transform entire log JSON format #1248

Closed
dflor003 opened this issue Nov 30, 2021 · 2 comments
Closed

Question: Transform entire log JSON format #1248

dflor003 opened this issue Nov 30, 2021 · 2 comments

Comments

@dflor003
Copy link

Hi! We're trying to leverage pino logger at a large enterprise with a very specific logging JSON format that needs to be sent to STDOUT and STDERR in order to be scraped by our PaaS system and processed by the ELK stack.

Looking through the docs, I see that you can use formatters to transform individual pieces of the logs. However, in our case, this would not be sufficient. Is there anything in the library outside of a custom transport that will allow us to transform the entire log message at once?

Here's a rough example of how our log message format needs to look:

{
  "applog": { // <- Our logs need to be nested under a specific root key
    "log_level": ...,
    "context": "...",
    "http_request": {
      ...
    },
    ...
  }
}

Any help would be appreciated. Thanks!

@mcollina
Copy link
Member

The best approach is to develop a custom transport that make it suit your needs, see https://getpino.io/#/docs/transports.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants