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

Add log request body example #76

Merged
merged 6 commits into from
Jan 21, 2020
Merged

Conversation

naseemkullah
Copy link
Contributor

Adds an example for a common use case of wanting the request body logged.

@naseemkullah
Copy link
Contributor Author

cc @mcollina

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should note that including body in the logs can cause security risks and have private user information (such as password and other GDPR-protected data) logged and persisted in long-term storage.

@naseemkullah
Copy link
Contributor Author

Updated as such.

Copy link
Member

@davidmarkclements davidmarkclements left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well written, sorry can we also add that logging the request bodies can also significantly affect performance.

We might also want to include an example of using the redact API on a request body

@naseemkullah
Copy link
Contributor Author

Yes and yes.

I am a little unfamiliar about the performance consequences apart from spitting out more bytes in theory reduces performance.
I mean if the body is huge, I could see why. Is there a way to measure this accurately? e.g. How much does an extra character slow down a request?

Showing how to redact in case you want to log the body but there is sensitive data? This would be great but a little beyond me, could you provide a snippet?

@mcollina
Copy link
Member

Yes, including more bytes slows down throughput. I don't have any specific data, because it depends on where you are sending the data to, and how fast that destination is.

As for log redaction, you can find it documented at http://getpino.io/#/docs/redaction.

@naseemkullah
Copy link
Contributor Author

Changes applied.

README.md Outdated Show resolved Hide resolved
Co-Authored-By: Matteo Collina <matteo.collina@gmail.com>
README.md Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit e302611 into pinojs:master Jan 21, 2020
@mcollina
Copy link
Member

Good work, thanks!

@naseemkullah
Copy link
Contributor Author

My pleasure!

@naseemkullah naseemkullah deleted the log-body-example branch January 21, 2020 12:49
@blairliu509
Copy link

How to log response body?

@pinojs pinojs locked and limited conversation to collaborators Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants