voxpupuli / puppet-logstash

Puppet module to manage Logstash
https://forge.puppet.com/elastic/logstash
Apache License 2.0
191 stars 299 forks source link

allow overriding default jvm options #417

Closed juliantaylor closed 1 year ago

juliantaylor commented 2 years ago

move the hardcoded defaults to a module argument to allow adapting them without changing the module. Uses defaults from current upstream branch (8.5)

Closes gh-397

xorpaul commented 2 years ago

LGTM and also tested it successfully :+1:

juliantaylor commented 2 years ago

can this or something equivalent get merged please

juliantaylor commented 1 year ago

ping

juliantaylor commented 1 year ago

there is actually another issue in this module (and logstash in the debian package at least) but it only occurs on new installations, the system-install called by the module does not load the startup options before trying to setup the JAVACMD:

. "$(cd `dirname $0`/..; pwd)/bin/logstash.lib.sh"
setup

if [ -z "$1" ]; then
  if [ -r /etc/logstash/startup.options ]; then
    OPTIONS_PATH=/etc/logstash/startup.options

this causes the setup to use a bundled java which may be a different version than /usr/bin/java the module sets up in startup.options this then causes it to use a different java version to parse the jvm.options than it uses to actually run java. This then fails as it uses options the wanted java does not support anymore. This is imo a bug in the logstash debian package, but can easily worked around by setting JAVACMD correctly in the logstas-system-install exec


--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -103,6 +103,11 @@ class logstash::service {
     if $logstash::restart_on_change {
       exec { 'logstash-system-install':
         command     => "${logstash::home_dir}/bin/system-install",
+        environment => ["JAVACMD=${startup_options['JAVACMD']}"],
         refreshonly => true,
         notify      => Service['logstash'],
       }