読者です 読者をやめる 読者になる 読者になる

Apache管理用の設定のうち、ログ関連

httpd.conf

LogFormat "%h %v %u %t \"%r\" %>s %b \"%{Referer}i\"\
\"%{User-Agent}i\"" combinedv

CustomLog "|/usr/pkg/sbin/rotatelogs -l\
/var/log/httpd/access_%Y%m%d.log 86400" combinedv

<VirtualHost *>
  DocumentRoot "/home/naruse/public_html"
  ServerName naruse.biz
  ServerAlias www.naruse.biz naruse.airemix.net
  SuexecUserGroup naruse users
  CustomLog "|/usr/pkg/sbin/rotatelogs -l /home/\
naruse/log/naruse.biz/access_%Y%m%d.log 86400" combinedv
  ErrorLog "|/usr/pkg/sbin/rotatelogs -l /home/\
naruse/log/naruse.biz/error_%Y%m%d.log 86400"
</VirtualHost>

ログ圧縮用のシェルスクリプト

#!/bin/sh
vhosts='/var/log/httpd /home/*/log'

todaylog=`date '+_%Y%m%d.log'`
for filename in
 `find $vhosts -type f -name "*_*.log" | grep -v $todaylog`
do
  gzip -9v "$filename"
done