[SaaS] Get proxied request size in bytes
Hello! I intent to use Cloudflare workers as some kind of a proxy backend in my proxy SaaS, i.e. serve request like (oversimplified):
-
https://mysaas.com/proxy-worker?clientId=12345&url=https://original-server.com/path
Problem: I need to record original server's request/response sizes in bytes per client, basically to bill my clients and display useful proxy analytics per client in my SaaS system.
Ideally, I want Cloudflare to send me reports like {"client_id":12345,"req_url":"...","req_size":12345,"res_size":12345}
, which is what I think Workers Trace Events Logpush was created for [1]. However, available workers_trace_events
dataset is very limited [2]; fields I can choose from does not include req/res sizes, and it seems that I can only get my client_id
by parsing Logs
or request url. The data I need is, however, present in the other dataset [3], but it is unavailable as I'm not yet on an enterprise plan [4] and can only use workers_trace_events
(as far as I understand).
Is there any other meaningful way to get req/res sizes per client_id to my servers for billing 💵 and analytics purposes 📈?
Related resources on Logpush:
[1] https://developers.cloudflare.com/workers/observability/logpush/
[2] https://developers.cloudflare.com/logs/reference/log-fields/account/workers_trace_events/
[3] https://developers.cloudflare.com/logs/reference/log-fields/zone/http_requests/
[4] https://developers.cloudflare.com/logs/about/
Sample worker trace event fields delivered, FYI
0 Replies