Checking firewall events via API

I want to check firewall events using the api (the ones that appear on the security tab), I am mainly interested in the number of events in a given time, how could I do this and what is the minimum time period I can check?
19 Replies
Erisa
Erisa6mo ago
Querying Firewall Events with GraphQL · Cloudflare Analytics docs
In this example, we are going to use the GraphQL Analytics API to query for Firewall Events over a specified time period.
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
Tysm, what is the minimum time period? And how could I see the amount of events on that time period? I have been experiencing DDoS, and I want to make a script that can check every 10 seconds for example how many events occurred in the last 10 seconds, and if a lot of events occurred, activate UAM automatically for a specific period of time, it would be great to see this as a feature though
Erisa
Erisa6mo ago
Minimum time period - like 1 minute I think? Maximum is 24 hours unless you have Business (72 hours) or Enterprise (30 days) and it will return the total amount, yes:
No description
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
Perfect, Tysm
Erisa
Erisa6mo ago
If you have skip rules setup with logging enabled then make sure to filter out the Skip actions or you'll get good traffic mixed up in the total
Erisa
Erisa6mo ago
If youre really sneaky on the dashboard you can look at the browser network log to see what queries it sends for last 30 minutes of security events excluding Skip it does some complex query like this (replace account and zone tags with your own)
Erisa
Erisa6mo ago
reupload in pretty print
Erisa
Erisa6mo ago
datetime_geq and datetime_leq need adjustment as well as account and zone tags
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
But there is more than one datetime thing
Erisa
Erisa6mo ago
yeah I'm not a GraphQL expert so I don't know why 😄 the queries from the dashboard are scary, you may have better luck making your own if you know what youre doing
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
I will, thank you for your help There is a problem What is the time from a log being made to it showing on the api?
Erisa
Erisa6mo ago
Between 1-3 minutes from my experience
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
Uhm That’s not very good
Erisa
Erisa6mo ago
Its not designed to be used as realtime logs 🙂
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
Is there any way to make it faster? And what is?
Erisa
Erisa6mo ago
No
Erisa
Erisa6mo ago
You need Business or Enterprise https://developers.cloudflare.com/logs Instant Logs through a websocket is the most realtime of them all
Cloudflare Logs · Cloudflare Logs docs
These logs are helpful for debugging, identifying configuration adjustments, and creating analytics, especially when combined with logs from other …
!                     SAKURA.sx❁
! SAKURA.sx❁6mo ago
Oh :c Isn’t there any other way without business or enterprise?
Erisa
Erisa6mo ago
No, the only other way to get events is through the GraphQL Analytics API which has a short delay as its not designed for realtime use But it should be sufficient for responding to threats within a matter of minutes
Want results from more Discord servers?
Add your server
More Posts
Wildcard worker route not working, no errors in panelI'm trying to create a route to my worker, it's a basic script that just returns the url you are accDeployment fails on upload files with zero helpOkay, so I try to upload via wrangler deploy, then via direct upload of my build folder, and there'sgoogle-api-javascript-client throw "Uncaught ReferenceError: window is not defined" in Remix CF pageI am trying to use google-api-javascript-client (recommended by google) in my Remix CF page projectFlotiq projectHello everyone, I'm not sure if this is the right place to post a comment, but I'm reaching out frombuild exceeded memory limit (on a very large NextJS app)Hey there, I've got a relatively large nextjs project and I'm running into the "build exceeded memorSelf hosting a media uploading service routed trough Cloudflare (At least on the DNS side)Hello there! I started running my own media uploading service and need to figure out routing. For teAI Gateway GraphQL to retrieve tokens cost, request & response.Hello! I'm trying AI Gateway to log the token cost. I followed the guide https://developers.cloudflaMy custom domain is stuck in either initializing or inactive (requires dns setup)I've been trying for at least 4 days now, I've been through the "Debugging Pages". I added all respWeb Analytics do not report fecthed URLsHi, I have a small SPA website, and have activated the web analytics. It workls fine, but does not Rate limiting with automatic WAFHi everyone, I'm building a completely serverless application using cloudflare workers and want to p