Pino Redact does not work with Pino HTTP customAttributeKeys.
See original GitHub issueI currently am using pino-http to map to an ECS format. When doing so though my redactions are not taking place.
redact: {
paths: ['http.request.headers.authorization'],
censor: '***REDACTED***',
},
customAttributeKeys: {
req: 'http.request',
},
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Issues · pinojs/pino-http - GitHub
Contribute to pinojs/pino-http development by creating an account on GitHub. ... Pino Redact does not work with Pino HTTP customAttributeKeys.
Read more >How to redact sensitive information from logs using Pino ...
We pass both the serializers (the pino standard error serializer) and redaction keys (more on this below) to the serializers key. Redacting keys....
Read more >HTTP Pino logger and Elastic Common Schema (ecs) format ...
The problem I face is now my log contains duplicate the req and the http.request and can't find a way to remove it....
Read more >How to redact sensitive information from logs using ... - Nikhil
Pino is a very low overhead logger for Node (their documentation claims it is over 5 times faster than alternatives). Here's how to...
Read more >Top 5 pino-std-serializers Code Examples - Snyk
Learn more about how to use pino-std-serializers, ... Use Snyk Code to scan source code in minutes - no build needed - and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sethtomy Your example doesn’t work because pino assumes that it should redact an object with the given structure:
{ http: { request: { headers: { authorization: "" }}}}
But in your case it’s:{ "http.request": { headers: { authorization: "" }}}
So to make it work, you just need to rewrite the path or use a key without dots in name:
@RohitRox thank you for responding. Unfortunately that does not seem to work in combination with “customAttributeKeys”.
@baterson that works perfectly! If you don’t mind, for my curiosity, I’m interested in how that’s working. A took ~ an hour to look into the issue myself but Streams unfortunately are not my strong suit (I need to learn 😃) How is the dot notation for ‘http.request.headers.authorization’ structurally different from ‘[“http.request”].headers.authorization’. Is there something special around that first “http.request” key?