« 2006年5月28日 | メイン | 2006年6月 2日 »

2006年6月 1日 アーカイブ

2006年6月 1日

Apacheのaccesslog

Apacheのアクセスログのカスタマイズ。
User Agentをログに残せば、いちいちCGIのアクセス解析使わなくても済むようになるなぁと今更に思った訳です。
特にJavascriptなんかでアクセス解析なんかをしているもので、普通に“閲覧”した方のログの記録がボチボチ残る程度で、Apacheのログの数と比べりゃそれはそれは天と地ほどの差がでるわけです。
一番信用のおけるApacheのログが使えるなら、これをとにもかくにも上手に使おうというわけです。前振り終わり。

UserAgentを残すだけならhttpd.conf(/etc/httpd/httpd.conf)にちょっと変更を加えるだけなので、わかってしまえば簡単。

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t ¥"%r¥" %>s %b ¥"%{Referer}i¥" ¥"%{User-Agent}i¥"" combined
LogFormat "%h %l %u %t ¥"%r¥" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "/private/var/log/httpd/access_log" common

こんな感じな部分があるので、最後の行の「common」を「combined」に変えるだけ。

CustomLog "/private/var/log/httpd/access_log" combined

About 2006年6月

2006年6月にブログ「独白」に投稿されたすべてのエントリーです。過去のものから新しいものへ順番に並んでいます。

前のアーカイブは2006年5月28日です。

次のアーカイブは2006年6月 2日です。

他にも多くのエントリーがあります。メインページやアーカイブページも見てください。