Search code examples
google-bigquerygoogle-cloud-platformcloudflarestackdriver

How to log X-Forwarded-For in Google Cloud HTTP Loadbalancer logging for export to BigQuery


I'm exporting all logs from Google Cloud HTTP Loadbalancer to BigQuery but I'm missing custom http headers like X-Forwarded-For with the origin ip from Cloudflare.

I don't see those headers in Stackdriver logging either, so it is probably not a problem of the sink export to BigQuery.

Where do I enable this logging?

Thanks


Solution

  • Currently the LogEntry is not supporting HTTP Headers. Based on the documentation, this is the supported structure.

    A workaround can be to collect logs after the Loadbalancer. The Loadbalancer will add the X-Forwarded-for values as a comma separated list to the request. https://cloud.google.com/compute/docs/load-balancing/http/#components