From cf71602cc76f7862d31890d800a3d1370895f9a0 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Fri, 4 Jul 2014 10:27:44 +1000 Subject: [PATCH] Add in rewrite rule to check swift If the requested file doesn't exist locally ask the os-loganalyze wsgi app to handle the request anyway incase it can fetch the request from swift. Change-Id: I8ed3a4c7b9a9fa682dbc4c3f3ffee8ddf2c237c6 --- modules/openstack_project/templates/logs-dev.vhost.erb | 8 ++++++++ modules/openstack_project/templates/logs.vhost.erb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/modules/openstack_project/templates/logs-dev.vhost.erb b/modules/openstack_project/templates/logs-dev.vhost.erb index 0d12464002..8cc5833134 100644 --- a/modules/openstack_project/templates/logs-dev.vhost.erb +++ b/modules/openstack_project/templates/logs-dev.vhost.erb @@ -61,6 +61,14 @@ NameVirtualHost <%= vhost_name %>:<%= port %> # rewrite all txt.gz & html.gz files to map to our internal htmlify wsgi app RewriteRule ^/(.*\.txt\.gz)$ /htmlify/$1 [QSA,L,PT] RewriteRule ^/(.*console\.html(\.gz)?)$ /htmlify/$1 [QSA,L,PT] + + # Check if the request exists as a file, directory or symbolic link + # If not, write the request to htmlify to see if we can fetch from swift + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l + RewriteRule ^/(.*)$ /htmlify/$1 [QSA,L,PT] + WSGIScriptAlias /htmlify /usr/local/lib/python2.7/dist-packages/os_loganalyze/wsgi.py ErrorLog /var/log/apache2/<%= name %>_error.log diff --git a/modules/openstack_project/templates/logs.vhost.erb b/modules/openstack_project/templates/logs.vhost.erb index 0d12464002..8cc5833134 100644 --- a/modules/openstack_project/templates/logs.vhost.erb +++ b/modules/openstack_project/templates/logs.vhost.erb @@ -61,6 +61,14 @@ NameVirtualHost <%= vhost_name %>:<%= port %> # rewrite all txt.gz & html.gz files to map to our internal htmlify wsgi app RewriteRule ^/(.*\.txt\.gz)$ /htmlify/$1 [QSA,L,PT] RewriteRule ^/(.*console\.html(\.gz)?)$ /htmlify/$1 [QSA,L,PT] + + # Check if the request exists as a file, directory or symbolic link + # If not, write the request to htmlify to see if we can fetch from swift + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l + RewriteRule ^/(.*)$ /htmlify/$1 [QSA,L,PT] + WSGIScriptAlias /htmlify /usr/local/lib/python2.7/dist-packages/os_loganalyze/wsgi.py ErrorLog /var/log/apache2/<%= name %>_error.log