From 507a4d9a23189494ed7b5998ca1a40d52de561ff Mon Sep 17 00:00:00 2001 From: ccbikai Date: Fri, 16 May 2025 19:02:14 +0800 Subject: [PATCH] feat: add COLO field to access log tracking Add Cloudflare COLO data to the access log tracking system to capture datacenter location information. This enables better monitoring of request distribution across Cloudflare's global infrastructure. The COLO field is mapped to blob16 in the blobs map and populated from the Cloudflare request headers. --- server/utils/access-log.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/utils/access-log.ts b/server/utils/access-log.ts index 2db2a55..991ef37 100644 --- a/server/utils/access-log.ts +++ b/server/utils/access-log.ts @@ -34,6 +34,7 @@ export const blobsMap = { blob13: 'browserType', blob14: 'device', blob15: 'deviceType', + blob16: 'COLO', } as const export const doublesMap = { @@ -140,6 +141,7 @@ export function useAccessLog(event: H3Event) { browserType: uaInfo?.browser?.type, device: uaInfo?.device?.model, deviceType: uaInfo?.device?.type, + COLO: cf?.colo, // For RealTime Globe latitude: Number(cf?.latitude || getHeader(event, 'cf-iplatitude') || 0),