Logstash-plugin and JVM options

Hi,

I'm having issues invoking logstash-plugin command while logstash is running. It fails with 'Cannot allocate memory' error. I believe the reason is it uses the same jvm.options file as logstash which defines 3GB java heap space. Is there any way to pass different jvm options to the logstash-plugin command?

I'm running Logstash 5.5.1 on CentOS 7 with 64-bit OpenJDK. My jvm.options file contains:

##  JVM configuration
-Xms3g
-Xmx3g

Logstash service runs ok but when I invoke logstash-plugin I get this error:

[root@logstash bin]# ./logstash-plugin
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000714cc0000, 2872311808, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2872311808 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/share/logstash/bin/hs_err_pid30054.log

We run salt for configuration automation in our environment so the logstash-plugin command is invoked regularly by this tool to check all required plugins are installed.

Cheers

If you set the LS_JVM_OPTS environment variable, it should use that jvm.options file rather than the jvm.options file pointed to by path.settings. See this code block which should demonstrate this functionality.

1 Like

Thanks, that is exactly what I was looking for. Actually, I just need to alter the -Xms and -Xmx settings rather than providing another jvm.options file, so LS_JAVA_OPTS works for me:

LS_JAVA_OPTS="-Xms256m -Xmx512m" /usr/share/logstash/bin/logstash-plugin list
1 Like

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