1.1.0 • Published 5 years ago
pino-sanitize v1.1.0
pino-sanitize
This is a transport for pinojs logger that sanitizes sensitive data, such as UUID, tokens, and hashes inside some log field.
A standard Pino log line like:
{"level":30,"time":1522431328992,"msg":"GET https://mydomain.com/api/v1/users/ca464889-8125-4910-bf4f-da404ad90106 - HTTP Status 200","pid":42,"hostname":"foo","v":1}Will format to:
{"level":30,"time":1522431328992,"msg":"GET https://mydomain.com/api/v1/users/:uuid - HTTP Status 200","pid":42,"hostname":"foo","v":1}Install
$ npm install -g pino-sanitizeUsage
It's recommended to use
pino-sanitizewithpinoby piping output to the CLI tool:
Thinking you have the start script in your package.json and you have the package installed globally
{
...
"scripts":{
...
"start": "node yourprocess.js"
},
...
}You can run the transform by running this command in your CLI
npm run start | pino-sanitizeCLI Arguments
--uuid(-u): Filter log removing UUID (defaults tofalse).--hash(-h): Filter log removing HASH (defaults tofalse).--qs(-q): Filter log removing Query Strings (defaults tofalse).--keys(-k): Define which keys should be sanitized (-k err,msg) (defaults toerr,error,msg,message).
Local development
Installing dependencies
nvm use
npm installRunning the logs sample locally
node example.js | node index.jsRunning unit tests
npm testPublish
this project is using np package to publish, which makes things straightforward. EX: np <patch|minor|major>
For more details, please check np package on npmjs.com
Author
Wilson Mendes (willmendesneto)