Linux – How to Diagnose Why Server Keeps Restarting

linuxuptime

It seems that my server keeps restarting. I want to know why.

How can I know when the last time server was rebooted and why?

root     pts/0        139.193.156.125  Thu Aug  8 21:10   still logged in
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 20:38 - 21:11  (00:33)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 20:15 - 21:11  (00:56)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 19:16 - 21:11  (01:55)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 18:56 - 21:11  (02:14)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 18:24 - 21:11  (02:47)
root     pts/1        139.193.156.125  Thu Aug  8 18:16 - crash  (00:07)
root     pts/0        195.254.135.181  Thu Aug  8 18:10 - crash  (00:13)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 17:52 - 21:11  (03:19)
root     pts/0        195.254.135.181  Thu Aug  8 17:38 - crash  (00:13)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 17:08 - 21:11  (04:02)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 16:58 - 21:11  (04:12)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 16:45 - 21:11  (04:26)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 16:35 - 21:11  (04:36)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 16:27 - 21:11  (04:44)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 15:59 - 21:11  (05:12)
reboot   system boot  2.6.32-358.11.1. Thu Aug  8 06:15 - 21:11  (14:56)
root     pts/1        208.74.121.102   Wed Aug  7 06:03 - 06:04  (00:00)
root     pts/1        208.74.121.102   Tue Aug  6 15:34 - 17:40  (02:05)
root     pts/0        139.193.156.125  Tue Aug  6 11:28 - 04:40 (1+17:11)

In Linux is there ANY WAY to know why the system rebooted? Specifically did high load cause it? If not that then What?

Best Answer

/var/log/messages

That is the main log file you should check for messages related to this. Additionally either /var/log/syslog (Ubuntu) or /var/log/secure (CentOS)

To find out when your server was last rebooted just type uptime to see how long it has been up.

Related Question