diff --git a/modules/logstash/files/logstash-indexer.conf b/modules/logstash/files/logstash-indexer.conf index 19d99712ca..49b2fc1619 100644 --- a/modules/logstash/files/logstash-indexer.conf +++ b/modules/logstash/files/logstash-indexer.conf @@ -1,6 +1,6 @@ -# logstash - indexer instance +logstash - indexer instance # -# Copied from http://cookbook.logstash.net/recipes/using-upstart/ +# Adapted from http://cookbook.logstash.net/recipes/using-upstart/ description "logstash indexer instance" @@ -10,15 +10,18 @@ stop on runlevel [06] # Respawn it if the process exits respawn respawn limit 5 30 -expect fork # You need to chdir somewhere writable because logstash needs to unpack a few # temporary files on startup. chdir /opt/logstash -script +setuid logstash - # This runs logstash indexer as the 'logstash' user - su -s /bin/sh -c 'exec "$0" "$@"' logstash -- /usr/bin/java -jar logstash.jar agent -f /etc/logstash/indexer.conf --log /var/log/logstash/indexer.log & - emit logstash-indexer-running +script + JAVA_ARGS='' + if [ -f /etc/default/logstash-indexer ] ; + then + . /etc/default/logstash-indexer + fi + exec /usr/bin/java $JAVA_ARGS -jar logstash.jar agent -f /etc/logstash/indexer.conf --log /var/log/logstash/indexer.log end script diff --git a/modules/openstack_project/files/logstash/logstash-indexer.default b/modules/openstack_project/files/logstash/logstash-indexer.default new file mode 100644 index 0000000000..57f6819aac --- /dev/null +++ b/modules/openstack_project/files/logstash/logstash-indexer.default @@ -0,0 +1,3 @@ +# Increase the max heap size to twice the default. +# Default is 25% of memory or 1g whichever is less. +JAVA_ARGS='-Xmx2g' diff --git a/modules/openstack_project/manifests/logstash_worker.pp b/modules/openstack_project/manifests/logstash_worker.pp index f3864b79af..5077cb7e93 100644 --- a/modules/openstack_project/manifests/logstash_worker.pp +++ b/modules/openstack_project/manifests/logstash_worker.pp @@ -27,6 +27,14 @@ class openstack_project::logstash_worker ( sysadmins => $sysadmins, } + file { '/etc/default/logstash-indexer': + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/openstack_project/logstash/logstash-indexer.default', + } + class { 'logstash::indexer': conf_template => 'openstack_project/logstash/indexer.conf.erb', }