epok
View as Markdown

AWS WAF logs and metrics

Updated Nov 22, 2026 · today

AWS WAF can deliver web ACL logs to CloudWatch Logs, and publishes metrics under the AWS/WAFV2 namespace. Both can reach Epok through the shared setup on AWS: logs and metrics.

On this page: What you getTurn on logsMetricsUseful searchesTroubleshooting

What you get

  • Logs: each web ACL log entry, from a group like aws-waf-logs-<name>. The entry is JSON that is stored as text in _msg; the fields inside it (rule, action, terminating rule) are not parsed yet.
  • Metrics: the AWS/WAFV2 namespace, which includes allowed, blocked and counted requests.

Each event also gets _time, a level detected from words in the line, service (the last part of the group name), log_group, log_stream, cloud.provider, cloud.account_id and cloud.region.

Turn on logs

  1. In the WAF & Shield console, open the web ACL, choose Logging and metrics, then Enable logging.
  2. Set the log destination to CloudWatch Logs and pick or create the log group.
  3. Add the group to EPOK_LOG_GROUPS and run the setup on AWS: logs and metrics.

Metrics

The namespace is AWS/WAFV2. It is not in the default metric stream list, so to receive it run the metrics setup with EPOK_METRIC_NAMESPACES=all (streams every namespace; check the cost first).

text
log_group:aws-waf-logs-* _msg:"BLOCK"        # blocked requests (prefix match on the group)
log_group:aws-waf-logs-* _msg:"XSS"           # a specific rule family
log_group:aws-waf-logs-* _time:1h | stats by (log_group) count()  # entries per web ACL

Because each entry is one text value, searches use _msg: for the contents. Filtering by rule name or action as separate fields is not supported yet.

Troubleshooting

  1. No group appears. Logging is off, or the destination was set to S3 or Kinesis Data Firehose instead of CloudWatch Logs. Reopen Logging and metrics and choose CloudWatch Logs.
  2. Fields are not searchable.Expected: WAF entries are stored as text, so search with _msg:. Parsed fields come later.
  3. Metrics missing. AWS/WAFV2 is not in the default list. Confirm you ran the metrics setup with EPOK_METRIC_NAMESPACES=all, then run bash aws-metrics.sh --verify-only.

Next