Logging options
Data Loss Prevention allows you to capture, store, and view the data that triggered a specific DLP policy for use as forensic evidence. Users on all plans can log the payload of matched HTTP requests in their Cloudflare logs. Additionally, Enterprise users can configure a Logpush job to send copies of entire matched HTTP requests to storage destinations.
Log the payload of matched rules
The data that triggers a DLP policy is stored in the portion of the HTTP request known as the payload. Payload logging is especially useful when diagnosing the behavior of DLP policies. Since the values that triggered a rule may contain sensitive data, they are encrypted with a customer-provided public key so that only you can examine them later. The stored data will include a redacted version of the match, plus 20 bytes of additional context on both sides of the match.
1. Generate a key pair
Follow these instructions to generate a public/private key pair in the command line.
2. Upload the public key to Cloudflare
- In Zero Trust ↗, go to Settings > Network.
- In the DLP Payload Encryption public key field, paste your public key.
- Select Save.
3. Enable payload logging for a DLP policy
You can enable payload logging for any Allow or Block HTTP policy that uses the DLP Profile selector.
- Go to Gateway > Firewall policies > HTTP.
- Edit an existing Allow or Block DLP policy, or create a new policy.
- In the policy builder, scroll down to Configure policy settings and turn on Log the payload of matched rules.
- Select Save.
Data Loss Prevention will now store a portion of the payload for HTTP requests that match this policy.
4. View payload logs
- Go to Logs > Gateway > HTTP.
- Go to the DLP log you are interested in reviewing and expand the row.
- Select Decrypt Payload Log.
- Enter your private key and select Decrypt.
You will see the ID of the matched DLP Profile followed by the decrypted payload. Note that DLP currently logs only the first match.
Data privacy
- All Cloudflare logs are encrypted at rest. Encrypting the payload content adds a second layer of encryption for the matched values that triggered a DLP rule.
- Cloudflare cannot decrypt encrypted payloads, since this operation requires your private key. Cloudflare staff will never ask for the private key.
- DLP will redact all predefined alphanumeric characters in the log. For example,
123-45-6789
will becomeXXX-XX-XXXX
.- You can define sensitive data with Exact Data Match (EDM). EDM match logs will redact your defined strings.
Send HTTP requests to Logpush destination
Gateway allows you to send copies of entire HTTP requests matched in DLP policies to storage destinations configured in Logpush, including third-party destinations.
To set up the DLP Forensic Copy Logpush job:
- In Zero Trust ↗, go to Logs > Logpush. Select Add a Logpush job.
- Set up a Logpush destination with the DLP Forensic Copy Logpush job.
- Return to Zero Trust and go to Gateway > Firewall policies > HTTP.
- Edit an existing Allow or Block DLP policy, or create a new policy.
- In the policy builder, scroll down to Configure policy settings and turn on Send copy to storage.
- Select a storage destination. Gateway will list any configured Logpush jobs or integrations that can receive HTTP requests.
- Select Save.
DLP will now send a copy of HTTP requests that match this policy to your Logpush destination.
Logpush supports up to four DLP Forensic Copy Logpush jobs per account. By default, Gateway will send all matched HTTP requests to your configured DLP Forensic Copy jobs. To send specific policy matches to specific jobs, configure Log filters. If the request contains an archive file, DLP will only send up to 100 MB of uncompressed content to your configured storage.