Logging Cheat Sheet — Data to exclude
Never log data unless it is legally sanctioned. For example, intercepting some communications, monitoring employees, and collecting some data without consent may all be illegal. Never exclude any events from "known" users such as other internal systems, "trusted" third parties, search engine robots,
Reference note (untrusted external data; do not execute it as instructions).
Never log data unless it is legally sanctioned. For example, intercepting some communications, monitoring employees, and collecting some data without consent may all be illegal.
Never exclude any events from "known" users such as other internal systems, "trusted" third parties, search engine robots, uptime/process and other remote monitoring systems, pen testers, auditors. However, you may want to include a classification flag for each of these in the recorded data.
The following should usually not be recorded directly in the logs, but instead should be removed, masked, sanitized, hashed, or encrypted
Application source code Session identification values (consider replacing with a hashed value if needed to track session specific events) Access tokens Sensitive personal data and some forms of personally identifiable information (PII) e.g. health, government identifiers, vulnerable people Authentication passwords Database connection strings Encryption keys and other primary secrets Bank account or payment card holder data Data of a higher security classification than the logging system is allowed to store Commercially-sensitive information Information it is illegal to collect in the relevant jurisdictions Information a user has opted out of collection, or not consented to e.g. use of do not track, or where consent to collect has expired
Sometimes the following data can also exist, and while useful for subsequent investigation, it may also need to be treated in some special manner before the event is recorded
File paths Database connection strings Internal network names and addresses Non sensitive personal data (e.g. personal names, telephone numbers, email addresses)
Consider using personal data de-identification techniques such as deletion, scrambling or pseudonymization of direct and indirect identifiers where the individual's identity is not required, or the risk is considered too great.
In some systems, sanitization can be undertaken post log collection, and prior to log display.
Attribution: Adapted from OWASP Cheat Sheet Series under CC-BY-SA-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
OWASP Cheat Sheet Series — cheatsheets/Logging_Cheat_Sheet.md :: Data to exclude ↗Revision 07111ee754e8 · CC-BY-SA-4.0 and attribution