Skip to content

Log the payload of matched rules

Last updated View as MarkdownAgent setup

The WAF allows you to log the request information that triggered a managed rule or custom rule. 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.

Payload logging is especially useful when diagnosing the behavior of WAF rules. 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.

Turn on payload logging

To turn on payload logging, configure a public key to encrypt the logged payload. You can configure the key at one of the following scopes:

  • Account: Applies to supported rule matches for every zone in the account that does not have a zone-level key.
  • Zone: Applies to supported rule matches in the zone. A zone-level key takes precedence over an account-level key.
  • Managed ruleset: Applies only to matches for a specific managed ruleset. This is the legacy configuration method.

An account-level or zone-level key takes precedence over a managed ruleset key. Configuring a key at either of these scopes does not delete existing managed ruleset keys. If no account-level or zone-level key applies, an existing managed ruleset key becomes effective again.

You can generate a key pair in the Cloudflare dashboard when configuring a managed ruleset, or use your own public key at any scope.

Once enabled, the WAF saves the payload of supported rule matches and encrypts it with your public key. If multiple rules checking the same request field match (for example, for the field http.cookie), the logged payload for that field will refer to the last matched rule.

Payload logging supports WAF managed rules and custom rules. It does not currently support rate limiting rules.

For more information, refer to Configure payload logging for Managed Rules or Configure payload logging via API.

View payload content

To view the content of the payload in clear text, do one of the following:

User role requirements

Only users with the Super Administrator role can enable payload logging or edit the payload logging configuration in the dashboard.

Was this helpful?