メンテナンス・トラブルシュート - ウェブサーバ - ログ解析 analog - anlgform.pl

クラウディア 
1. 概要
2. コピー
3. 編集

1. 概要

 「anlgform.pl」は、「analog」のプログラム本体になります。

2. コピー

 展開先からコピーして、実行権限を与えます。  「cgi」の実行ディレクトリが

/usr/local/www/apache24/cgi-bin/
 として、「root」ユーザで

cd /usr/local/www/apache24/cgi-bin/
cp /usr/local/share/examples/analog/anlgform.pl .
chmod +x anlgform.pl

3. 編集

 このままでは、実行できないので、編集します。  「root」ユーザで

vi /usr/local/www/apache24/cgi-bin/anlgform.pl

#!/usr/bin/perl -T
###
###              analog 6.0             http://www.analog.cx/
### This program is copyright (c) Stephen R. E. Turner 1995 - 2004 except as
### stated otherwise.
###
### This program is free software. You can redistribute it and/or modify it
### under the terms of version 2 of the GNU General Public License, which you
### should have received with it.
###
### This program is distributed in the hope that it will be useful, but
### without any warranty, expressed or implied.
### Remember: Even the most carefully-designed CGI programs can accidentally
### have serious security bugs! See docs/form.html for notes on security
### design.
###
### anlgform.pl; the cgi front end for analog

# 1) uncomment (remove everything before $analog) and edit one of the next two
#    lines to give the location (full pathname) of the analog executable.
#       Unix: $analog = '/usr/local/etc/httpd/analog-6.0/analog';
#       Windows: $analog = 'C:\program files\analog 6.0\analog.exe';
# 2) If you're on Unix, edit the first line in this file to give the location
#    of Perl (don't remove the #! though).
# 3) You also need to edit anlgform.html if you want to use the form.
# 4) Add to the forbidden commands below if you want.

@forbidden = qw(LOGFORMAT APACHELOGFORMAT DEFAULTLOGFORMAT
                APACHEDEFAULTLOGFORMAT HEADERFILE FOOTERFILE UNCOMPRESS
                OUTFILE CACHEOUTFILE LOCALCHARTDIR ERRFILE DNS CGI
                SETTINGS PROGRESSFREQ LANGFILE DESCFILE);
 1行目は、「FreeBSD」であれば、必須で書き換えます。  「perl」がいる場所は、違いますのでね。

#!/usr/local/bin/perl -T
 ちなみに、「-T」は、とっぱらっちゃっても構わないようです。  「-T」オプションに関して、参考にしていたサイトがありましたが、リンク切れになりました。  26行目の下に、下記の行を加えます。

$analog = '/usr/local/bin/analog';
 これが、さらにバイナリのロードモジュールになります。  29行目の、「APACHEDEFAULTLOGFORMAT」の1語を削除します。

@forbidden = qw(LOGFORMAT DEFAULTLOGFORMAT
                APACHEDEFAULTLOGFORMAT HEADERFILE FOOTERFILE UNCOMPRESS
                OUTFILE CACHEOUTFILE LOCALCHARTDIR ERRFILE DNS CGI
                SETTINGS PROGRESSFREQ LANGFILE DESCFILE);
 これで、「apache」のログが解析対象となります。
ハイスピードプラン