Logstash not starting with 'Cannot allocate memory' error

I have set up ELK in my aws t2.medium instance (4 GB RAM) & it was working fine until today morning when logstash failed. This was the error I encountered while trying to start logstash

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 
174456832, 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 174456832 bytes for committing reserved 
memory.
# An error report file with more information is saved as:
# /home/ubuntu/hs_err_pid24701.log

jvm.options for logstash has -Xmx to 1 GB & -Xms to 256 MB. For elastic search it is max heap is 2 GB & min heap is 256 MB

But on checking the memory usage on the instance, top command shows
KiB Mem: 4046832 total, 3927576 used, 119256 free, 13144 buffers.

I am not sure how 3.9 GB RAM is being used as elastic search , kibana are all idle with Logstash being down.

So can someone help me explain how can this ram issue be fixed ?

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