Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have dedicated server running centos 6.0, and apache and the mysql

all of a sudden for some reason server has gone down, so i had to reboot the server and it all worked back to normal,

However i am wondering how do i get following information, I tried to use "uptime" command this only gives me the time that the server is running what i need to find out is

1. Actual time the server went down ?
2. How long the server has been down ?

...etc

any ideas?

share|improve this question
    
pingdom.com –  ceejayoz Dec 23 '13 at 18:01

3 Answers 3

up vote 5 down vote accepted

You look through the in files /var/log.

Even if you don't find the errors that caused the outage outright, most of the files will have timestamps so you'll see a big gap in them - from the time the outage started, until you rebooted it.

Of course, this only works if the server actually stopped running - such as a kernel panic. If it was something like a misconfigured network card, it would still have been writing to the logs.

If it's a fairly busy webserver, you can also look through the access logs to see when it was last accessed before the reboot.

share|improve this answer
1  
/var/log/messages is probably going to be the best to start with, but it would be wise to get familiar with all the log files in there so you know what gets logged where. –  drinxy Mar 8 '13 at 2:14

Please execute the below command at shell.

last | grep down

share|improve this answer
2  
This answer is not correct. –  tristan Dec 23 '13 at 17:44
    
I don't see down anywhere in the last output, whether for a normal restart or a simulated power failure restart. –  Michael Hampton Dec 23 '13 at 22:49

This is why you need a monitoring system.


Check your logs. There should be a gap in timestamps when your server was down. From that gap, you can get the approximate time when it went down as well as the duration.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.