# Logstash-plugin and JVM options

**URL:** https://discuss.elastic.co/t/logstash-plugin-and-jvm-options/99646
**Category:** Logstash
**Created:** [September 7, 2017, 1:02am UTC](https://discuss.elastic.co/t/logstash-plugin-and-jvm-options/99646 "2017-09-07T01:02:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jakub.krauz](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jakub.krauz](https://discuss.elastic.co/u/jakub.krauz)
#### Post date: [September 7, 2017, 1:02am UTC](https://discuss.elastic.co/t/logstash-plugin-and-jvm-options/99646/1 "2017-09-07T01:02:13Z")

</div>

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:

```auto
## JVM configuration
-Xms3g
-Xmx3g

```

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

```auto
[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

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [September 7, 2017, 2:39am UTC](https://discuss.elastic.co/t/logstash-plugin-and-jvm-options/99646/2 "2017-09-07T02:39:49Z")

</div>

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](https://github.com/elastic/logstash/blob/v5.5.2/bin/logstash.lib.sh#L31-L49) which should demonstrate this functionality.

---

<div class="post-metadata">

### Author: ![jakub.krauz](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jakub.krauz](https://discuss.elastic.co/u/jakub.krauz)
#### Post date: [September 7, 2017, 3:18am UTC](https://discuss.elastic.co/t/logstash-plugin-and-jvm-options/99646/3 "2017-09-07T03:18:26Z")

</div>

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:

```auto
LS_JAVA_OPTS="-Xms256m -Xmx512m" /usr/share/logstash/bin/logstash-plugin list

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 5, 2017, 3:18am UTC](https://discuss.elastic.co/t/logstash-plugin-and-jvm-options/99646/4 "2017-10-05T03:18:28Z")

</div>

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