[Solved] Logstash can't start up: not enough memory

This is what top showed

top - 13:28:06 up 837 days, 15:14,  6 users,  load average: 0.17, 0.13, 0.16
Tasks: 352 total,   2 running, 350 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3%us,  0.1%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%st
Mem:  16432788k total,   830188k used, 15602600k free,     2576k buffers
Swap: 18481144k total,  2343896k used, 16137248k free,   141652k cached

I suppose the free memory was enough.

And I can't find any document about how to configure logstash's memory allocation.

Thank you for help.

You have tons of free memory. What's the exact error message and where did you find it? The Logstash log?

And I can't find any document about how to configure logstash's memory allocation.

The JVM heap size is configured via startup options that are normally set via /etc/default/logstash (Debian-based systems) or /etc/sysconfig/logstash (RPM-based systems).

1 Like

The error msg showed just I typed

$ ./logstash -h
Can't start up: not enough memory

I've tried set the env param export LS_HEAP_SIZE=500m, and logstash ran. But I couldn't figure out what happened.

Logstash is currently, by default started with heap config like https://github.com/elastic/logstash/blob/master/pkg/jvm.options#L6-L7, you can see it does between Xms256m and -Xmx1g, so you should be covered.

can you share with us your logstash version? and machine specs? as @magnusbaeck said from your top command it really looks like you got enough memory.

1 Like

I solved this problem by upgrading java from 1.4 to 1.8.

It seemed the problem was caused by low java version.

Thank you for help.