=encoding euc-jp =head1 名前 Apache::DBILogConfig - アクセス情報をDBIデータベースにログ出力 =head1 概要 # httpd.confで PerlLogHandler Apache::DBILogConfig PerlSetVar DBILogConfig_data_source DBI:Informix:log_data PerlSetVar DBILogConfig_username informix PerlSetVar DBILogConfig_password informix PerlSetVar DBILogConfig_table mysite_log PerlSetVar DBILogConfig_log_format "%b=bytes_sent %f=filename %h=remote_host %r=request %s=status" =head1 説明 このモジュールは標準のApacheモジュールmod_log_configの機能を複写しています。しかし ファイルではなくDBI互換性のあるデータベースに情報をログ出力します。 (ドキュメントの一部はmod_log_configから拝借してきました。) =head1 トークン一覧 =over 4 =item DBILogConfig_data_source "DBI::driver:database"という形式のDBIデータソース。 =item DBILogConfig_username 接続するときにデータベース・ドライバに渡されるユーザ名 =item DBILogConfig_password 接続するときにデータベース・ドライバに渡されるパスワード =item DBILogConfig_table ログをとるためのデータベース上のテーブル =item DBILogConfig_log_format ログ出力されるデータを定義する空白で区切られた書式が入った文字列(下記の書式文字列をご覧ください) =back =head1 書式文字列 書式文字列は以下のような書き方の文字列で構成されます: B<%[条件][{パラメータ}]フォーマット=フィールド> =head2 フォーマット Formats specify the type of data to be logged. The following formats are accepted: =over =item a Remote IP-address =item A Local IP-address (not yet supported) =item B Bytes sent, excluding HTTP headers. =item b Bytes sent, excluding HTTP headers. In CLF format i.e. a '-' rather than a 0 when no bytes are sent. =item c Connection status when response is completed. 'X' = connection aborted before the response completed. '+' = connection may be kept alive after the response is sent. '-' = connection will be closed after the response is sent. (not yet supported) =item e The contents of the environment variable specified by parameter =item f Filename =item h Remote host =item H The request protocol =item i The contents of the header (specified by parameter) in the request sent to the server. =item l Remote logname (from identd, if supplied) =item m The request method =item n The contents of note (specified by parameter) from another module. =item o The contents of the header (specified by parameter) in the reply. =item p The canonical Port of the server serving the request =item P The process ID of the child that serviced the request. =item q The query string (prepended with a ? if a query string exists, otherwise an empty string) =item r First line of request =item s Status. For requests that got internally redirected, this is the status of the *original* request. =item t Time, in common log format time format or the format specified by parameter, which should be in strftime(3) format. =item T The time taken to serve the request, in seconds. =item u Remote user (from auth; may be bogus if return status (%s) is 401) =item U The URL path requested. =item v The canonical ServerName of the server serving the request. =item V The server name according to the UseCanonicalName setting (not yet supported). =back =head2 フィールド データがログ出力されるデータベースの列 =head2 パラメータ パラメータを取る書式のためのもの 例: %{DOCUMENT_ROOT}e =head2 条件 Conditions are a comma-separated list of status codes. If the status of the request being logged equals one of the status codes in the condition the data specified by the format will be logged. By placing a '!' in front of the conditions, data will be logged if the request status does not match any of the conditions. Example: %!200,304,302s=status will log the status of all requests that did not return some sort of normal status =head1 デバッグ LOGLEVELが'warn'以上に設定されていると、デバッグのためのステートメントはエラーログに書き込まれます。 =head1 必要なもの =over =item * mod_perl >= PerlLogHandlerが利用可能になっている 1.11_01 =item * DBI =item * Date::Format =back =head1 インストール このモジュールをインストールするためには、このファイルがあるディレクトリに 移動し、以下のようにタイプしてください: perl Makefile.PL make make test make install これによりモジュールがPerlライブラリ・ディレクトリにインストールされます。 インストールしたら、Webサーバーの構成設定を上記のように変更する必要があります。 =head1 注意 このモジュールをインストールし設定した後でも、(以前、そのように設定されていたならば) Apacheは通常のアクセスログファイルにログを続けます。アクセスをデータベースにだけ ログ出力させるためには、CustomLogかTransferLogをコメント・アウトするか、それらを/dev/nullに 設定してください。 =head1 作者(=AUTHOR) Copyright (C) 1998, Jason Bodnar . All rights reserved. This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. =head1 参考資料 perl(1), mod_perl(3) =head1 翻訳者 川合孝典(GCD00051@nifty.ne.jp)