R2 Bucket + Custom domain logging/analytics

Hi! I've recently releases an API that is based on pre-generating the responses, putting them all in r2 and then serving that through a custom domain, and I am interested in trying to gather some logging/analytics about issues that the end users of the api will be hitting Mainly I would like to know which paths have been returning a 404. and i think this can be solved with some logging and/or analytics. I'm currently on the pro plan and couldn't find anything in the dashboard that looked like I could get this information, would someone be able to point me in the right direction and/or discuss some possibilities for solutions?
11 Replies
Erisa
Erisa•12mo ago
On the traffic analytics you should be able to add a filter to show requests with status 404
Yantrio
YantrioOP•12mo ago
Thanks for the quick response! Is there a way to export all of this data rather than just viewing the top 5 results?
Erisa
Erisa•12mo ago
As a sidenote you can change that to top 15
No description
Erisa
Erisa•12mo ago
But its important to remember that analytics arent the same as logs, there isn't an entry on every single request just sampled aggregate data. With that in mind if you want more control over what data you retrieve and in a machine readable format you can use the api: https://developers.cloudflare.com/analytics/graphql-api/
GraphQL Analytics API · Cloudflare Analytics docs
The GraphQL Analytics API provides data regarding HTTP requests passing through Cloudflare’s network, as well as data from specific products, such as …
Erisa
Erisa•12mo ago
R2 custom domains dont have a logging facility so if sampled analytics arent enough youll have to write a Worker and use that to log (either to your own system or to Workers Trace Events Logpush)
Yantrio
YantrioOP•12mo ago
Thats understandable. Thanks for talking it through! I'll see if i can get what I need from the analytics, otherwise maybe I'll look at logging with a worker but that could end up quite costly 😦
Erisa
Erisa•12mo ago
Yeah We get so much traffic that logging everything kind of has to be a paid option 😅 if everyone's requests were fully logged it would be a gigantic additional load
Yantrio
YantrioOP•12mo ago
That makes perfect sense. I wouldn't want to log that much either. Is there a way we can get it as a paid option? or is it 100% off the table for r2 right now?
Erisa
Erisa•12mo ago
Not outside of workers currently, may change in future
Yantrio
YantrioOP•12mo ago
Thanks for this @Erisa | Support Engineer ! much appreciated.
cube2222
cube2222•12mo ago
The analytics API was exactly what we were looking for, as we can now easily get the top 100 (sampling is completely fine for us), worked like a charm!
Want results from more Discord servers?
Add your server