Log HTTP Request ClientCountry violates ISO-3166 country code

Based on Country Codes Collection (iso.org), the 2 letter country code should be in uppercase.

Currently, the logs is giving country code in lowercase.

This is giving me an issue as when I’m trying to consume the logs for reporting, my reporting platform is not reading the 2 letter country code as it is in lowercase, which violates the country codes listed in ISO-3166.

Workaround is for me to manually convert them to uppercase on my side.

However, the cleaner approach is for Cloudflare provide the country code in UPPERCASE format based on ISO-3166 list of country codes.

Country Codes Collection (iso.org)


That’s a good point. It’s weird how logs have ClientCountry in lower case, but seems to be upper case everywhere else, like ip.src.country in Rules Fields.

Unfortunately, I highly doubt Cloudflare will change this, as it would break for anybody who’s already set up for lower case country codes.

1 Like

Well in the documentation HTTP requests · Cloudflare Logs docs, it says ClientCountry is “2-letter ISO-3166 country code of the client IP address.”.

So it should be right to fix the formatting to uppercase.

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