スキップしてメイン コンテンツに移動

投稿

7月, 2013の投稿を表示しています

SetEnvIf の Request_URI には Query String は含まれない

クエリストリングを含んでいたときだけ、ログに記録したくなかたったので、調べてみた。 まぁ、結論はタイトルに書いてあるのだが、 これを知らなかったおかげで、1時間無駄にした。 じゃあ、どうやって制御するかというとこんな感じ。 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^/hogehoge/index\.html RewriteCond %{QUERY_STRING} id=123 RewriteRule ^(.*)$ $1 [E=nolog:1] </IfModule> CustomLog "| /usr/sbin/rotatelogs /var/log/httpd/access_log.%Y%m%d 86400 540" combined env=!nolog /hogehoge/index.html はログに記録されるけど /hogehoge/index.html?id=123 はログに記録されない。

HTTP_HOST と SERVER_NAME の違い

あざーっす。 http://phpspot.org/blog/archives/2006/05/server_namehttp.html --2013/9/17 追記-- 上の説明を読んで色々試してみたんだけど、やっぱり違いがわからなかった。 そんな時は、やっぱりドキュメント読まなきゃね。 ■Apache HTTP サーバ バージョン 2.2 ドキュメント UseCanonicalName ディレクティブ

maillogの世代管理

maillogの世代管理を、デフォルトの4週間から1年(54週)に延ばす。 # cd /etc/logrotate.d/ # cp syslog mail # vi mail /var/log/maillog {     rotate 54     sharedscripts     postrotate         /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true     endscript } # vi syslog /var/log/messages /var/log/secure /var/log/spooler /var/log/boot.log /var/log/cron {     sharedscripts     postrotate         /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true     endscript }