pino
pino copied to clipboard
Question: Transform entire log JSON format
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!
The best approach is to develop a custom transport that make it suit your needs, see https://getpino.io/#/docs/transports.
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.