Parse Cloudflare Logs JSON data
After downloading your Cloudflare Logs data, you can use different tools to parse and analyze your logs.
One of those tools used to parse your JSON log data is jq. To get started with jq, visit the jq official site ↗.
To aggregate a field appearing in the log, such as by IP address, URI, or referrer, you can use several jq commands. This is useful to identify any patterns in traffic; for example, to identify your most popular pages or to block an attack.
The following examples match on a field name and provide a count of each field instance, sorted in ascending order by count.
Another common use case involves filtering data for a specific field value and then aggregating after that. This helps answer questions like Which URLs saw the most 502 errors? For example:
To find out the top IP addresses blocked by the Cloudflare WAF, use the following query:
To retrieve your cache ratios, try the following query:
To find out which TLS versions your visitors are using — for example, to decide if you can disable TLS versions that are older than 1.2 — use the following query: