それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

Apacheのログレベルの高低

Apacheのmoduleを設定するときは、ログレベルを下げて、ログを見ると効果的。ログを使うことで途中経過などが分かり便利に、WEBにあまり情報のないmod_ldapなんてとっても便利。

ログの設定値による量の変化

ログは少量
↓   emerg 用
↓   alert 
↓   crit 
↓   error 
↓   warn 
↓   notice
↓   info 
↓   debug 
ログは多量

各レベルの意味

レベル 説明
emerg 緊急 - システムが利用できない
alert 直ちに対処が必要
crit 致命的な状態
error エラー
warn 警告
notice 普通だが、重要な情報
info 追加情報
debug デバッグメッセージ

CentOSのばあい

"/etc/httpd/conf/httpd.conf"
 485 # LogLevel: Control the number of messages logged to the error_log.
 486 # Possible values include: debug, info, notice, warn, error, crit,
 487 # alert, emerg.
 488 #
 489 #LogLevel warn
 490 LogLevel debug   #ログをdebugに設定
 491
出力先
/var/log/httpd/error_log.2010-12-17 #デフォルト
/var/log/httpd/ssl_error_log        #デフォルト HTTPS(SSL)の場合)
出力例

ApacheLDAPにldaps://で接続するようす
tail -f /var/log/httpd/error_log.2010-12-17

[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1008): [9233] auth_ldap url parse: Host: ldap.example.ac.jp
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1010): [9233] auth_ldap url parse: Port: 636
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1012): [9233] auth_ldap url parse: DN: ou=Students,dc=ldap,dc=example,dc=ac,dc=jp
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1014): [9233] auth_ldap url parse: attrib: uid
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1016): [9233] auth_ldap url parse: scope: base
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1019): [9233] auth_ldap url parse: filter: (null)
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(1093): LDAP: auth_ldap using SSL connections
[Fri Dec 17 14:39:26 2010] [debug] mod_authnz_ldap.c(390): [client 192.168.95.46] [9233] auth_ldap authenticate: using URL ldaps://ldap.example.ac.jp/
[Fri Dec 17 14:39:26 2010] [warn] [client 192.168.95.46] [9233] auth_ldap authenticate: user foo authentication failed; URI 
/ldap/ [User not found][No such object]
[Fri Dec 17 14:39:26 2010] [error] [client 192.168.95.46] user foo not found: /ldap/

Debianの場合 /etc/apache2/apache2.conf

178 # LogLevel: Control the number of messages logged to the error_log.
179 # Possible values include: debug, info, notice, warn, error, crit,
180 # alert, emerg.
181 #
182 LogLevel warn

またはVirtualHost

  1 <VirtualHost *:80>
  2   ServerName  photo.utena.jp
  3   DocumentRoot /home/takuya/public_html/zenphoto
  4   <Directory /home/takuya/public_html/zenphoto>
  5     DirectoryIndex index.html index.php
  6     LogLevel debug
  7     Allow from all
  8   </Directory>
  9
 10 </VirtualHost>
 11

参考

http://httpd.apache.org/docs/2.2/ja/mod/core.html#loglevel


CentOSって全体設定に及ぶので設定がめんどくさいなぁ。Debian見たいに小分けにしてくれたらピンポイントで管理が楽なのに・・・