Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Payload Logging, Matched Data Encryption, and Decryption

How Cloudflare WAF and DLP encrypt matched-rule payloads with your public key, enable logging, and decrypt evidence safely.

This page summarizes Cloudflare documentation on payload logging: capturing the request data that triggered a security or DLP match, encrypting it with a customer-provided public key, and decrypting it locally so only your team can read sensitive trigger context.

Payload logging: what gets logged and why encrypt it

Section titled “Payload logging: what gets logged and why encrypt it”

The Web Application Firewall (WAF) can log request information that triggered a specific rule in a managed ruleset. That information is the payload: the string that triggered the rule, plus text immediately before and after the match.

The WAF allows you to log the request information that triggered a specific rule of a managed ruleset. This information is known as the payload. Payload information includes the specific string that triggered the rule, along with the text that appears immediately before and after the match.

— Cloudflare, Log the payload of matched rules

Payload logging helps diagnose rule behavior. Because triggers may contain secrets, Cloudflare encrypts logged values with your public key before storage.

Data Loss Prevention (DLP) can log the HTTP body (uploads, forms, chat messages) that caused a policy match—for example to confirm a real finding versus a false positive. DLP stores a redacted match plus surrounding context (75 bytes on each side of the match in the logging-options documentation).

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.

— Cloudflare, Logging options

DLP payload logging and AI prompt logging use your public key on all plans; Logpush forensic copies of full HTTP requests are Enterprise-only and rely on TLS in transit rather than the same payload encryption model (Logging options).

For WAF and DLP encrypted payloads, Cloudflare does not hold your private key:

DLP uses public-key encryption so that matched sensitive data is readable only by you — Cloudflare does not have access to your private key and cannot decrypt your logs.

— Cloudflare, DLP settings

Cloudflare cannot decrypt encrypted payloads, since this operation requires your private key. Cloudflare staff will never ask for the private key.

— Cloudflare, Log the payload of matched rules

Logs are already encrypted at rest; payload encryption adds a second layer on the matched values (Log the payload of matched rules, Logging options).

matched-data-cli: generate a public key pair for logging

Section titled “matched-data-cli: generate a public key pair for logging”

WAF payload logging and DLP both point to the matched-data-cli tool to generate keys in the terminal (Generate a key pair, Command-line operations).

  1. Download matched-data-cli for your platform from the GitHub Releases page (Generate a key pair).

  2. Extract the archive and open a terminal in the folder containing the binary.

  3. Run key generation:

    ./matched-data-cli generate-key-pair
  4. Copy the public_key value into your WAF or DLP configuration. Store the private_key securely offline—you need it for every decryption.

Example output from the docs:

{
"private_key": "uBS5eBttHrqkdY41kbZPdvYnNz8Vj0TvKIUpjB1y/GA=",
"public_key": "Ycig/Zr/pZmklmFUN99nr+taURlYItL91g+NcHGYpB8="
}

Alternatively, in WAF setup you can generate a key pair in the browser; Cloudflare stores only the public key—you must save the displayed private key yourself (Configure payload logging in the dashboard, Log the payload of matched rules).

WAF payload logging: enable public key on managed rulesets

Section titled “WAF payload logging: enable public key on managed rulesets”

Each managed ruleset has its own payload logging settings. Only Super Administrator users can configure WAF payload logging or change its public key (Configure payload logging in the dashboard, User role requirements).

Dashboard: configure payload logging on an execute rule

Section titled “Dashboard: configure payload logging on an execute rule”

In the dashboard, open Security rules, find the managed ruleset’s rule with an Execute action, then Configure payload logging at the bottom of the rule page (Configure payload logging in the dashboard):

  • Generate key pair using your web browser, or
  • Use my own public key from matched-data-cli.

Save after acknowledging the implications.

API and Terraform: matched_data.public_key

Section titled “API and Terraform: matched_data.public_key”

For automation, add a matched_data object to the execute rule that deploys the managed ruleset (Configure payload logging via API):

"action_parameters": {
"matched_data": {
"public_key": "<PUBLIC_KEY_VALUE>"
}
}

Obtain the http_request_firewall_managed entry point ruleset ID and the execute rule ID via the ruleset API, then patch the rule. Account-level managed rulesets use the account entry point and account ruleset rule APIs (Enterprise). To disable payload logging, remove matched_data from action_parameters (Configure payload logging via API).

The same matched_data.public_key pattern appears in WAF Managed Rules configuration using Terraform.

Topic Behavior
Historical events Payload data exists only for matches after logging is enabled—not for past Security Events (Turn on payload logging).
Multiple matches on one field For the same request field (e.g. http.cookie), the logged payload refers to the last matched rule (Turn on payload logging).
Context size in Logpush After decryption, before / after hold at most 15 bytes each (Structure of encrypted matched data).

DLP payload logging: encryption key, masking, and policy settings

Section titled “DLP payload logging: encryption key, masking, and policy settings”

Upload the DLP payload encryption public key

Section titled “Upload the DLP payload encryption public key”

Before DLP payload logs work, set DLP Payload Encryption public key under Zero Trust → Data loss prevention → DLP settings (DLP settings, Set a DLP payload encryption public key).

Payload log masking: how much match text you see after decrypt

Section titled “Payload log masking: how much match text you see after decrypt”

Masking is chosen at detection time, before encryption (Payload log masking):

Level Effect (example SSN)
Full Mask (default) ***-**-****
Partial Mask ***-**-6789 (25% visible)
Clear Text Full match visible

The level applies to all sensitive matches in the payload window, not only the rule that triggered the policy (Payload log masking). Exact Data Match (EDM) logs redact your defined strings (Data privacy).

Turn on payload logging for a DLP HTTP policy

Section titled “Turn on payload logging for a DLP HTTP policy”

For Allow or Block HTTP policies that use the DLP Profile selector, enable Log the payload of matched rules under Configure policy settings (Turn on payload logging for a DLP policy).

By default, HTTP request logs show that a match occurred but not the matched content until logging options are configured (View DLP logs, 4. View DLP logs).

Decrypt payload content: dashboard, CLI, and Logpush

Section titled “Decrypt payload content: dashboard, CLI, and Logpush”

WAF Security Events: decrypt in the browser

Section titled “WAF Security Events: decrypt in the browser”

On Analytics → Events, expand a sampled log for a rule whose ruleset has payload logging. Under Matched service, choose Decrypt payload match, enter your private key, and decrypt (View the payload content in the dashboard).

The private key is not sent to a Cloudflare server. The decryption occurs entirely in the browser.

— Cloudflare, View the payload content in the dashboard

DLP HTTP request logs: decrypt payload log

Section titled “DLP HTTP request logs: decrypt payload log”

Go to Insights → Logs → HTTP request logs, expand a row, select Decrypt payload log, enter your private key (View payload logs). Cloudflare does not store the key or decrypted payload (View payload logs).

Users without Super Administrator role may still decrypt if they can access logs and hold the private key (Configure payload logging in the dashboard).

matched-data-cli: decrypt on the command line

Section titled “matched-data-cli: decrypt on the command line”
  1. Place the private key and encrypted payload in files (restrict key file permissions).

    printf "<PRIVATE_KEY>" > private_key.txt && chmod 400 private_key.txt
    printf "<ENCRYPTED_PAYLOAD>" > encrypted_payload.txt
  2. Decrypt:

    decrypt -k private_key.txt encrypted_payload.txt

See Decrypt the payload content for examples and note that encryption formats can change—update matched-data-cli from GitHub if decryption fails.

Logpush: encrypted_matched_data and SIEM decryption

Section titled “Logpush: encrypted_matched_data and SIEM decryption”

WAF Firewall Events Logpush jobs can include encrypted matched data in General → Metadata as encrypted_matched_data (Store decrypted matched payloads in logs). Cloudflare publishes a sample Worker that receives Logpush, decrypts with your private key, and forwards to your storage (Store decrypted matched payloads in logs).

Decrypted structure maps match locations (URI, headers, body) to before, content, and after fields—single object or array when multiple matches exist (Structure of encrypted matched data property in Logpush).

Section titled “Related customer-key log encryption (AI Gateway Logpush)”

AI Gateway Logpush uses a hybrid model: AES-GCM for bulk log data and RSA to wrap the per-log AES key (How logs are encrypted). You generate an RSA key pair locally, upload the public key to gateway settings, and decrypt exported logs with your private key—separate from WAF matched-data-cli keys (Logpush). That path is for AI Gateway observability, not WAF matched-rule payloads.

Common mistakes and verification checklist

Section titled “Common mistakes and verification checklist”
  • Enabling logging without saving the private key after browser key generation—only the public key remains at Cloudflare (Turn on payload logging).
  • Expecting payloads on old events—only post-enable matches are captured (Turn on payload logging).
  • Rotating keys without a plan—older ciphertext becomes permanently unreadable (DLP settings).
  • Assuming DLP dashboard shows content by default—configure logging options and decrypt explicitly (4. View DLP logs).
  • Using outdated matched-data-cli when encryption format changes (Decrypt the payload content).
  1. Confirm your plan supports the feature (WAF payload logging requires Enterprise per Log the payload of matched rules; DLP payload logging is available on all plans per Logging options).
  2. Verify a public key is configured on the WAF execute rule (matched_data) or in DLP settings, matching the private key you stored.
  3. Trigger a controlled test match after enabling logging, then open Security Events or HTTP request logs and confirm encrypted payload fields appear.
  4. Decrypt one entry in the dashboard or with matched-data-cli and confirm content / masking matches your policy (View the payload content in the dashboard, View payload logs).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.