Incrase heap size for logstash indexers.

The default java heap size is too small for our logstash indexers.
Double it to 2g. Do this by adding an /etc/default/logstash-indexer file
that the upstart configs source if it is present. This required some
tweaks to the upstart configuration to load the defaults properly.

Co-Authored-By: K Jonathan Harker <k.jonathan.harker@hp.com>
Change-Id: I63447f59f3fa6d466a7d275476121fe8339479dc
This commit is contained in:
Clark Boylan 2014-02-27 10:06:39 -08:00
parent eb0fd1382f
commit 4454aac98f
3 changed files with 21 additions and 7 deletions

View File

@ -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

View File

@ -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'

View File

@ -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',
}