Logstahs complains of short memory and stalls

Hello,

Recently I have a crash in logstash, looking the logs I saw that it was due to memory, the log said the below

    root@VSPB:/var/log/logstash# cat logstash.err.1 

    Error: Your application used more memory than the safety cap of 600M.

    Specify -J-Xmx####m to increase it (#### = cap size in MB).

    Specify -w for full OutOfMemoryError stack trace

I have increased it to 2GB ( with LS_HEAP_SIZE=2000m) my server has 4GB. However whole logstash was stopped, which shouldn't happen, I would like that the service doesn't crash but it restarted instead, is that possible to do within logstash init script?

On the other hand, I would like to set up the optionLOGSPOUT=ignore for logstahsh, where can I add this setting?

Thanks in advance,

Best regards