From: Tom Hughes Date: Fri, 17 Jul 2015 18:27:57 +0000 (+0100) Subject: Add a request ID to connect frontend and backend logs X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/893a007aefd9a28ff0bf233c2f3f45cc352f882f?hp=c0ec6e0ae7ac9c723d678e92061c02667f6aa0ad Add a request ID to connect frontend and backend logs --- diff --git a/cookbooks/web/recipes/backend.rb b/cookbooks/web/recipes/backend.rb index 6f86f2064..ae359ca47 100644 --- a/cookbooks/web/recipes/backend.rb +++ b/cookbooks/web/recipes/backend.rb @@ -28,6 +28,7 @@ apache_module "remoteip" apache_module "rewrite" apache_module "proxy" apache_module "proxy_fcgi" +apache_module "setenvif" apache_site "default" do action [:disable] diff --git a/cookbooks/web/recipes/frontend.rb b/cookbooks/web/recipes/frontend.rb index 6f62f3186..1be89358c 100644 --- a/cookbooks/web/recipes/frontend.rb +++ b/cookbooks/web/recipes/frontend.rb @@ -31,6 +31,7 @@ apache_module "proxy_balancer" apache_module "lbmethod_byrequests" apache_module "lbmethod_bybusyness" apache_module "rewrite" +apache_module "unique_id" apache_site "default" do action [:disable] diff --git a/cookbooks/web/templates/default/apache.backend.erb b/cookbooks/web/templates/default/apache.backend.erb index d6dc4cd39..4380f5ca7 100644 --- a/cookbooks/web/templates/default/apache.backend.erb +++ b/cookbooks/web/templates/default/apache.backend.erb @@ -28,6 +28,11 @@ # RewriteEngine on + # + # Recover the unique ID from the request headers + # + SetEnvIf X-Request-Id ^(.*)$ UNIQUE_ID=$1 + # # Configure rails # diff --git a/cookbooks/web/templates/default/apache.frontend.erb b/cookbooks/web/templates/default/apache.frontend.erb index 5177f89eb..d0260be3d 100644 --- a/cookbooks/web/templates/default/apache.frontend.erb +++ b/cookbooks/web/templates/default/apache.frontend.erb @@ -30,6 +30,11 @@ ExpiresActive On RewriteEngine on + # + # Add the unique ID to the request headers + # + RequestHeader set X-Request-Id %{UNIQUE_ID}e + # # Block troublesome GPX data scrapping #