CentOS ログ・ステータスファイルまとめ

この記事は KainokiKaede Advent Calendar 2014 9日目の記事です(大嘘)

サーバーの OS として CentOS をよく使うのですが、ときどき「あのログファイルってどこにあったっけ」「あのステータスどうやって見るんだっけ」となるのでまとめました。

ログ

$ sudoedit /var/log/httpd/access_log
$ sudoedit /var/log/httpd/error_log
$ sudoedit /var/log/cron

cron は、cron さえ実行されれば異常終了してもエラーは吐かれない。次のように cron を実行すると実行時のログを保存できる。

*/30 * * * * /bin/sh /home/hoge/fuga.sh >>/tmp/analog.log 2>>/tmp/analog-err.log 

ステータス

$ du -h  # Directory size
$ service httpd status
$ chkconfig --list httpd
$ sensors

ハードウェア

$ cat /proc/cpuinfo | grep "model name"  # CPU
$ cat /proc/meminfo | grep Mem  # Memory
$ free -m  # Memory
$ df -h  # Storage
$ cat /etc/issue  # OS Version
$ uname -a  # OS
$ sudo netstat -tanp | grep LISTEN  # Listen Port list
$ ifconfig # IP address

ネットワーク

$ ping -c 4 google.com  # Check whether the Internet is visible

ソフト

$ yum check-update