Download Cloudflare WAF Logs via API


I am using the PRO Plan and am trying to download WAF logs (daily) via an API.

Any help or resources on the same would be greatly appreciated.

You need to write a script to query the GraphQL API. Here’s an example of the query for Firewall Events (includes all WAF logged events, that is, events that triggered an action such as Block, Challenge, Log etc.):

You can also save a lot of time by using the comprehensive API script developed by @eva2000:


Utmost grateful for the resource provided. Currently, testing the shell script provided in the github link.

Do you know any open source dashboarding tools where I could upload the generated .csv files from the above script ?

1 Like

No, I don’t. I normally just convert CSV into ODS an open the resulting file with LibreOffice Calc. I’ve once tried to import the CSV into web log analyzer GoAccess, but soon realized it would take a lot of time to meaningfully adapt that tool to the fields generated by Cloudflare’s Firewall, and gave it up.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.