Reverse proxy subset of elasticsearch API.

It has been requested that we provide programmatic access to the
elasticsearch API in addition to the Kibana web UI. Do this by reverse
proxying http://logstash.openstack.org/elasticearch/$API_REQUEST to
http://elasticsearch.openstack.org:9200/$API_REQUEST.

The only values for $API_REQUEST that will be passed through are
_aliases, _status, and _search.

Change-Id: Ib41f6d91e2e59d493218074a67155af450ec8c93
Reviewed-on: https://review.openstack.org/33316
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Clark Boylan 2013-06-17 10:12:54 -07:00 committed by Jenkins
parent db9aa860cd
commit f51d974205
3 changed files with 12 additions and 2 deletions
modules
logstash
manifests
templates
openstack_project/manifests

@ -19,6 +19,7 @@ class logstash::web (
$serveradmin = "webmaster@${::fqdn}",
$frontend = 'internal',
$elasticsearch_host = 'localhost',
$proxy_elasticsearch = false
) {
include apache
a2mod { 'rewrite':

@ -8,6 +8,14 @@
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-access.log combined
<% if proxy_elasticsearch == true %>
# Proxy for elasticsearch _aliases, .*/_status, and .*/_search.
<LocationMatch "^/elasticsearch/(_aliases|.*/_status|.*/_search)$">
ProxyPassMatch http://<%= scope.lookupvar("::logstash::web::elasticsearch_host") %>:9200/$1
</LocationMatch>
ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::elasticsearch_host") %>:9200/
<% end %>
ProxyPass / http://127.0.0.1:5601/ retry=0
ProxyPassReverse / http://127.0.0.1:5601/
</VirtualHost>

@ -30,8 +30,9 @@ class openstack_project::logstash (
}
class { 'logstash::web':
frontend => 'kibana',
elasticsearch_host => 'elasticsearch.openstack.org',
frontend => 'kibana',
elasticsearch_host => 'elasticsearch.openstack.org',
proxy_elasticsearch => true,
}
package { 'python-daemon':