「ログの見かた」~初心者でもよくわかる!VPSによるWebサーバー運用講座(1)
より勉強
ログファイルを実際に見てみましょう。
su でルートユーザーにスイッチしたあと、 /var/log/httpd ディレクトリに移動
su でルートユーザーにスイッチしたあと、 /var/log/httpd ディレクトリに移動
$ su –
パスワード: (パスワードを入力)
# cd /var/log/httpd
# ls
パスワード: (パスワードを入力)
# cd /var/log/httpd
# ls
(図1)

tail -f コマンドで中を覗いてみましょう。
# tail -f access_log
# tail -f access_log
ブラウザでVPS上のコンテンツ
http://160.16.50.187
にアクセス、
sshクライアントにリアルタイムでログが記録されていくのが分かる。。。
http://160.16.50.187
にアクセス、
sshクライアントにリアルタイムでログが記録されていくのが分かる。。。
怪しいユーザーがサーバーにログインしていないかどうかをチェックする
$ last
$ lastlog
$ last
$ lastlog
(図2)

以上