# Logstash Too small initial heap

**URL:** https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068
**Category:** Logstash
**Created:** [November 15, 2016, 8:00am UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068 "2016-11-15T08:00:54Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![manojvenkat](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@manojvenkat](https://discuss.elastic.co/u/manojvenkat)
#### Post date: [November 15, 2016, 8:00am UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/1 "2016-11-15T08:00:54Z")

</div>

Team,

I have installed logstash 2.2 on my AWS linux instance .

When I executed the command to test the config file: service logstash configtest I get the heap error as below,  
[root@ip-10-34-77-105 conf.d]# service logstash configtest  
Error occurred during initialization of VM  
Too small initial heap

I ran the below commands to set JAVA options. But no hope ☹  
export \_JAVA\_OPTIONS="-Xmx2048m -Xms1024m"

I increased xmx and xms up to 4096m, but still end up in same error.

Please advice.

---

<div class="post-metadata">

### Author: ![manojvenkat](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@manojvenkat](https://discuss.elastic.co/u/manojvenkat)
#### Post date: [November 15, 2016, 12:30pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/2 "2016-11-15T12:30:02Z")

</div>

Team,

Additional info.  
My AWS instance memory is 8GB and 2 CPUs (m4.large). Please suggest.

---

<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: [November 15, 2016, 12:57pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/3 "2016-11-15T12:57:11Z")

</div>

Try setting them in `LS_JAVA_OPTS` at the beginning of the line, or exporting the env variable. Also, you can try `JAVA_OPTS`.

---

<div class="post-metadata">

### Author: ![manojvenkat](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@manojvenkat](https://discuss.elastic.co/u/manojvenkat)
#### Post date: [November 15, 2016, 3:13pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/4 "2016-11-15T15:13:22Z")

</div>

> [@theuntergeek](#):
>
> LS\_JAVA\_OPTS

@theuntergeek Thanks for reply. Could you please guide on how to set the parameter. I tried

export LS\_JAVA\_OPTS "-Xmx2048m -Xms1024m" , but getting export: `-Xmx2048m -Xms1024m': not a valid identifier

---

<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: [November 15, 2016, 3:34pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/5 "2016-11-15T15:34:30Z")

</div>

> [@manojvenkat](#):
>
> export LS\_JAVA\_OPTS "-Xmx2048m -Xms1024m

Try: `export LS_JAVA_OPTS="-Xmx2048m -Xms1024m"`

The equals sign is important.

---

<div class="post-metadata">

### Author: ![manojvenkat](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@manojvenkat](https://discuss.elastic.co/u/manojvenkat)
#### Post date: [November 15, 2016, 3:40pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/6 "2016-11-15T15:40:30Z")

</div>

Yes I tried with = as well ☹ but i see same error

[root@ip-10-34-77-105 init.d]# export LS\_JAVA\_OPTS= "-Xmx2048m -Xms1024m"  
bash: export: `-Xmx2048m -Xms1024m': not a valid identifier

---

<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: [November 15, 2016, 3:53pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/7 "2016-11-15T15:53:37Z")

</div>

There's a space after the = in your example.

---

<div class="post-metadata">

### Author: ![manojvenkat](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@manojvenkat](https://discuss.elastic.co/u/manojvenkat)
#### Post date: [November 15, 2016, 3:58pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/8 "2016-11-15T15:58:24Z")

</div>

> [@theuntergeek](#):
>
> export LS\_JAVA\_OPTS="-Xmx2048m -Xms1024m"

Thanks a lot for support. Even after setting the same I getting heap error.  
root@ip-10-34-70-115 init.d]# export LS\_JAVA\_OPTS="-Xmx2048m -Xms1024m"  
[root@ip-10-34-70-115 init.d]# service logstash configtest  
Error occurred during initialization of VM  
Too small initial heap  
[root@ip-10-34-77-105 init.d]# export LS\_JAVA\_OPTS="-Xmx2048m -Xms2048m"  
[root@ip-10-34-77-105 init.d]# service logstash configtest  
Error occurred during initialization of VM  
Too small initial heap  
[root@ip-10-34-77-105 init.d]# export JAVA\_OPTS="-Xmx4096m -Xms4096m"  
[root@ip-10-34-77-105 init.d]# service logstash configtest  
Error occurred during initialization of VM  
Too small initial heap

---

<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: [November 15, 2016, 4:20pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/9 "2016-11-15T16:20:04Z")

</div>

Here I was, thinking you were launching Logstash from the command line.

Put the JVM settings in /etc/sysconfig/logstash or /etc/default/logstash depending on which one your system uses.

---

<div class="post-metadata">

### Author: ![manojvenkat](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@manojvenkat](https://discuss.elastic.co/u/manojvenkat)
#### Post date: [November 16, 2016, 10:27am UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/10 "2016-11-16T10:27:55Z")

</div>

> [@manojvenkat](#):
>
> "-Xmx2048m -Xms2048m"

I did try with this option as well. But still no hopes.

Alternatively I created m4.xlarge instance in AWS(4 cpus and 16gb memory) and installed Logstash there. But even there I get same error.

---

<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: [November 17, 2016, 2:28pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/11 "2016-11-17T14:28:59Z")

</div>

I meant that you should put `LS_JAVA_OPTS="-Xmx2048m -Xms2048m"` in /etc/default/logstash or /etc/sysconfig/logstash, not just the JVM options themselves.

---

<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: [December 15, 2016, 2:29pm UTC](https://discuss.elastic.co/t/logstash-too-small-initial-heap/66068/12 "2016-12-15T14:29:13Z")

</div>

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