diff --git a/docs/changelog.d/fix-real-client-ip-logging.bugfix.md b/docs/changelog.d/fix-real-client-ip-logging.bugfix.md new file mode 100644 index 0000000..466a789 --- /dev/null +++ b/docs/changelog.d/fix-real-client-ip-logging.bugfix.md @@ -0,0 +1 @@ +Log real client IPs in Fly.io proxy access logs using Fly-Client-IP header instead of showing the internal proxy address. diff --git a/fly/alloy.river b/fly/alloy.river index 213d8c5..36417d4 100644 --- a/fly/alloy.river +++ b/fly/alloy.river @@ -24,6 +24,7 @@ loki.process "nginx" { // Parse the JSON log line stage.json { expressions = { + client_ip = "client_ip", status = "status", method = "request_method", host = "http_host", diff --git a/fly/nginx.conf b/fly/nginx.conf index 135183e..f01a1a3 100644 --- a/fly/nginx.conf +++ b/fly/nginx.conf @@ -13,6 +13,7 @@ http { '{' '"time":"$time_iso8601",' '"remote_addr":"$remote_addr",' + '"client_ip":"$http_fly_client_ip",' '"request_method":"$request_method",' '"request_uri":"$request_uri",' '"status":$status,'