Allow viewing of .log.gz files

I'm not sure why, but previously we have not passed .log.gz files
through to the htmlify web-app.  This means clicking on it in the
browser prompts to download the file.  This is unlikley to be what
devlopers investigating logs interactively want.

Traditionally in devstack-gate there's been a bunch of renaming
log->log.txt that happens to make the files presentable [1].  With
zuulv3 native jobs this happens less and everyone has to be aware of
this behaviour (e.g. Ia7415d2fbbb320f8eddc4e46c3a055414df5f997 is a
good example of raw .log files being added).  I think it is fine to
assume a .log file is text that is safe to pass through os-loganalyze.

From my reading of os-loganalyze [2], a .log.gz file would get mached
by util.use_passthrough_view and by default be filtered via a HTMLView
-- thus the file_conditions.yaml update is perhaps unnecessary, but
provided just to keep things in sync with .txt which has always been
there (I9cda9c05f42c5658d1c1dde8aa2efbc0abcc48a2)

[1] https://git.openstack.org/cgit/openstack-infra/devstack-gate/tree/functions.sh#n869
[2] https://git.openstack.org/cgit/openstack-infra/os-loganalyze/tree/os_loganalyze/view.py#n237

Change-Id: I72e4f752713e7947bd66dfe8164976f0a4e3af24
This commit is contained in:
Ian Wienand 2018-02-12 10:05:15 +11:00
parent d6888706c1
commit 3eacddb2d7
2 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,9 @@ conditions:
- filename_pattern: ^.*\.txt(\.gz)?$
filter: SevFilter
view: HTMLView
- filename_pattern: ^.*\.log(\.gz)?$
filter: SevFilter
view: HTMLView
- filename_pattern: ^.*console\.html(\.gz)?$
filter: SevFilter
view: HTMLView

View File

@ -84,15 +84,15 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.gz -f
RewriteRule ^/(.*)$ %{REQUEST_URI}.gz
# rewrite txt.gz & console.html[.gz] files to map to our internal htmlify
# wsgi app
# rewrite (txt|log).gz & console.html[.gz] files to map to our
# internal htmlify wsgi app
# PT, Pass-through: to come back around and get picked up by the
# WSGIScriptAlias
# NS, No-subrequest: on coming back through, mod-autoindex may have added
# index.html which would match the !-f condition. We
# therefore ensure the rewrite doesn't trigger by
# disallowing subrequests.
RewriteRule ^/(.*\.txt\.gz)$ /htmlify/$1 [QSA,L,PT,NS]
RewriteRule ^/(.*\.(txt|log)\.gz)$ /htmlify/$1 [QSA,L,PT,NS]
RewriteRule ^/(.*console\.html(\.gz)?)$ /htmlify/$1 [QSA,L,PT,NS]
# Check if the request exists as a file, directory or symbolic link