Unable to set heap size via LS_HEAP_SIZE on logstash 5.1.1


(Marco Spadoni) #1

I am currently using logstash 5.1.1 on CentOS 7 sending it into execution from a bash shell. When using logstash 2.3.4 I was able to run several instances each one with a different maximum heap size, by making use of the LS_HEAP_SIZE environment variable (together with --allow-env option). With 5.1.1 it seems that the variable is overridden, since all other variables (significant to the filtering stage of the pipeline) are correctly set, but the heap is not changed (examined via Java VisualVM). I am able to change the heap by editing config/jvm.options file, but this has the inconvenience that the value contained in that file is used for each started instance. Any hint is welcome, thanks.


(Magnus Bäck) #2

together with --allow-env option

--allow-env has nothing to do with the JVM options.

I am able to change the heap by editing config/jvm.options file, but this has the inconvenience that the value contained in that file is used for each started instance.

Perhaps this thread is useful:


#3

You can set the heap size via environment variable, LS_JAVA_OPTS

I use the following in our startup script.
export LS_JAVA_OPTS=" -Xmx4g -Xms4g"

From first few lines of bin/logstash scrip, see line 13:

$ cat -n bin/logstash

     1  #!/bin/sh
     2  # Run logstash from source
     3  #
     4  # This is most useful when done from a git checkout.
     5  #
     6  # Usage:
     7  #   bin/logstash <command> [arguments]
     8  #
     9  # See 'bin/logstash --help' for a list of commands.
    10  #
    11  # Supported environment variables:
    12  #   LS_JVM_OPTS="xxx" path to file with JVM options
    13  #   LS_JAVA_OPTS="xxx" to append extra options to the defaults JAVA_OPTS provided by logstash
    14  #   JAVA_OPTS="xxx" to *completely override* the defauls set of JAVA_OPTS provided by logstash

This works for me. Hope that helps.


(Marco Spadoni) #4

It works!
Many thanks to you and also to Magnus.
Marco


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.