I have a CentOS 5.8-based VPS and for 4 months I have been facing random system hangs every 2 or 3 days; then I need to reset the VPS through its control panel. How and where can I start debugging those hangs?
You should start by looking in your logs at a time immediately before the server hangs.– user9517Sep 1, 2012 at 6:53
I have no idea when exactly the server is going to hang, it just happens and when it does,I can not even get into the control panel of my vps,I only can reset - reboot or power off-on the vps from a simple panel from hwhere i bought my VPS.– HosseinSep 1, 2012 at 7:41
So look in your logs immediately before you restarted the system.– user9517Sep 1, 2012 at 7:49
@lain: I am saying i can not log in to the servers control panel when it hangs!The only way to manipulate server is by using a simple (reset-power off-on switch panel that the company from which i bought my vps gave me).This is the panel im talking about : upload.ustmb.ir/uploads/…– HosseinSep 1, 2012 at 8:05
When you have restarted your system, go to your logs and examine them. You'll notice the entries have timestamps. Look for entries timestamped prior to the time that you restarted your system ...– user9517Sep 1, 2012 at 8:08
this link is usefull concerning logs on centos : http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-logfiles.html
35.1. Locating Log Files
Most log files are located in the /var/log/ directory. Some applications such as httpd and samba have a directory within /var/log/ for their log files.
You may notice multiple files in the log file directory with numbers after them. These are created when the log files are rotated. Log files are rotated so their file sizes do not become too large. The logrotate package contains a cron task that automatically rotates log files according to the /etc/logrotate.conf configuration file and the configuration files in the /etc/logrotate.d/ directory. By default, it is configured to rotate every week and keep four weeks worth of previous log files.
read /var/logs/messages for general stuff look for access_log / error_log in apache directory / virtualhost for your website
you should read them all and try to get a clue to what is going wrong look in /var/log/messages and do some research on what you found and add it to your question so people may have more info to help you
note that logs have to be read from bottom to top as the last entries contains the last (error) data
don't post everything if the file is too big , just the last 20 lines for example will be a good start (ex.
tail -n 20 /var/log/messages )
Thank you ,But which one should i look into? there are error in httpd but im not sure what they are.Such as: [Sun Aug 19 14:00:41 2012] [error] [client 220.127.116.11] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:) [Sun Aug 19 22:31:27 2012] [error] [client 18.104.22.168] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)– HosseinSep 1, 2012 at 12:15
edited , see above– maazzaSep 1, 2012 at 12:41