how to know if the server runs out of RAM before crashing down
You should check /var/log/messages
The dmesg
command will not be useful in this case because it only shows you the kernel messages since last boot.
"Running out of memory" is not usually enough to completely crash Linux. Linux will start killing processes when it runs out of memory (OOM killer). So you would probably look for some kernel panic. If you're using less
to read the logs, you can search pressing the /
key.
But the bottom line is: you should first read /var/log/messages. It is ordered by time, so it's easy to find the moment when the server last booted. Check what happened before that, which caused your server to crash.
if linux runs out of memory it usually starts the OOM killer (Out Of Memory). Thats a kernel process which goes around killing other procs to free memory. if this happens you should see according logs when you enter dmesg
.
try this: dmesg | grep -i oom
. if there is no output, the OOM killer probably didnt kill your process.