Apacheのログを複数ユーザーにも適用
ユーザー様個別のエラーログを取るように設定する。
mkdir /var/log/httpd/ユーザー名
#vi /etc/httpd/conf/httpd.conf
ServerAdmin ユーザー名のアドレス
DocumentRoot /home/ユーザー名/public_html
ServerName ユーザーのドメイン名
ErrorLog /var/log/httpd/ユーザー名/error_log
CustomLog /var/log/httpd/ユーザー名/access_log combined env=!nolog
#service httpd restart
溜まったログを古いものから削除する
#vi /etc/logrotate.d/apache/var/log/httpd/access_log { ←この行の直下に
daily
rotate 14
missingok
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
上記2行を追加
続いて最下部にでも下記を追加
-------------------------------------
/var/log/httpd/*/access_log { daily rotate 14 missingok postrotate /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true endscript }/var/log/httpd/*/error_log {
daily
rotate 14
missingok
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
-------------------------------------
:wq
#cat /var/log/httpd/ユーザー名/error_log
で確認できる