AlmaLinux10にApacheアクセスログ解析(AWStats)をインストール設定



AWStatsダウンロード 
[root@falcon21 ~]# wget http://prdownloads.sourceforge.net/awstats/awstats-8.0-1.noarch.rpm
2025-11-13 08:45:05 (2.15 MB/s) – `awstats-8.0-1.noarch.rpm’ へ保存完了 [2988164/2988164]

    ※最新版のURLはダウンロードページで確認 
     2025-08-26 16:20  awstats-8.0-1.noarch.rpm

—————–
AWStatsインストールに必要なperl をインストール

[root@falcon21 ~]# perl -v

This is perl 5, version 40, subversion 2 (v5.40.2) built for x86_64-linux-thread-multi
(with 16 registered patches, see perl -V for more detail)

Copyright 1987-2025, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using “man perl” or “perldoc perl”. If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.


[root@falcon21 ~]# perl -V
Summary of my perl5 (revision 5 version 40 subversion 2) configuration:

Locally applied patches:
Fedora Patch1: Removes date check, Fedora/RHEL specific
Fedora Patch2: support for libdir64
Fedora Patch3: use libresolv instead of libbind
Fedora Patch4: USE_MM_LD_RUN_PATH
Fedora Patch5: Provide MM::maybe_command independently (bug #1129443)
Fedora Patch6: Dont run one io test due to random builder failures
Fedora Patch8: Define SONAME for libperl.so
Fedora Patch9: Install libperl.so to -Dshrpdir value
Fedora Patch10: Make *DBM_File desctructors thread-safe (RT#61912)
Fedora Patch11: Replace EU::MakeMaker dependency with EU::MM::Utils in IPC::Cmd (bug #1129443)
Fedora Patch12: Link XS modules to pthread library to fix linking with -z defs
Fedora Patch13: Pass the correct CFLAGS to dtrace
Fedora Patch14: Fix CVE-2025-40909
Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux
Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux
Fedora Patch202: Add definition of OPTIMIZE to .ph files
Built under linux
Compiled at Jul 10 2025 00:00:00
@INC:
/usr/local/lib64/perl5/5.40
/usr/local/share/perl5/5.40
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

—————-

Validate::IPモジュールインストール

[root@falcon21 ~]# perl -MCPAN -e shell

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer ‘no’ below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]

CPAN.pm は設定が必要ですが、そのほとんどは自動で行えます。
以下の質問で「いいえ」と答えると、代わりに各設定オプションごとに対話型ダイアログが表示されます。

可能な限り自動設定しますか?[はい]

We initialized your ‘urllist’ to https://cpan.org/. Type ‘o conf init urllist’ to change it.

Autoconfiguration complete.

commit: wrote ‘/root/.local/share/.cpan/CPAN/MyConfig.pm’

You can re-run configuration any time with ‘o conf init’ in the CPAN shell
Terminal does not support AddHistory.

To fix that, maybe try> install Term::ReadLine::Perl


cpan shell — CPAN exploration and modules installation (v2.36)
Enter ‘h’ for help.

‘urllist’ を https://cpan.org/ に初期化しました。変更するには ‘o conf init urllist’ と入力してください。

自動設定が完了しました。

コミット: ‘/root/.local/share/.cpan/CPAN/MyConfig.pm’ を書き込みました

CPAN シェルでは、いつでも ‘o conf init’ で設定を再実行できます。
ターミナルは AddHistory をサポートしていません。

この問題を解決するには、次を試してください: install Term::ReadLine::Perl

cpan shell — CPAN の探索とモジュールのインストール (v2.36)
ヘルプを表示するには ‘h’ と入力してください。

cpan[1]> install Term::ReadLine::Perl
Fetching with HTTP::Tiny:
https://cpan.org/authors/01mailrc.txt.gz
Reading ‘/root/.local/share/.cpan/sources/authors/01mailrc.txt.gz’
………………………………………………………………….DONE
Fetching with HTTP::Tiny:
https://cpan.org/modules/02packages.details.txt.gz
Reading ‘/root/.local/share/.cpan/sources/modules/02packages.details.txt.gz’
Database was generated on Wed, 21 Jan 2026 16:41:01 GMT
…………..
New CPAN.pm version (v2.38) available.
[Currently running version is v2.36]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.


……………………………………………………..DONE
Fetching with HTTP::Tiny:
https://cpan.org/modules/03modlist.data.gz
Reading ‘/root/.local/share/.cpan/sources/modules/03modlist.data.gz’
DONE
Writing /root/.local/share/.cpan/Metadata
Running install for module ‘Term::ReadLine::Perl’
Fetching with HTTP::Tiny:
https://cpan.org/authors/id/I/IL/ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
Fetching with HTTP::Tiny:
https://cpan.org/authors/id/I/IL/ILYAZ/modules/CHECKSUMS
Checksum for /root/.local/share/.cpan/sources/authors/id/I/IL/ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz ok
Scanning cache /root/.local/share/.cpan/build for sizes
DONE
Configuring I/IL/ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz with Makefile.PL
Checking if your kit is complete…
Looks good
Warning: LINKTYPE set to ”, no longer necessary
Generating a Unix-style Makefile
Writing Makefile for Term::ReadLine
Writing MYMETA.yml and MYMETA.json
ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
/usr/bin/perl Makefile.PL — OK
Running make for I/IL/ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
cp ReadLine/readline.pm blib/lib/Term/ReadLine/readline.pm
cp ReadLine/Perl.pm blib/lib/Term/ReadLine/Perl.pm
ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
/usr/bin/make — OK
Running make test for ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
PERL_DL_NONLAZY=1 “/usr/bin/perl” “-Iblib/lib” “-Iblib/arch” test.pl
Use of uninitialized value $ENV{“PERL_RL_TEST_PROMPT_MINLEN”} in bitwise or (|) at test.pl line 33.
at test.pl line 33.
Features present: attribs 1 newTTY 1 autohistory 1 tkRunning 1 preput 1 addHistory 1 appname 1 minline 1 setHistory 1 getHistory 1 ornaments 1

Flipping rl_default_selected each line.

Hint: Entering the word
exit
would exit the test. 😉 (If feature ‘preput’ is present,
this word should be already entered.)

Enter arithmetic or Perl expression: exit
Terminal does not support GetHistory.
Lockfile removed.
ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
/usr/bin/make test — OK
Running make install for ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
Installing /usr/local/share/perl5/5.40/Term/ReadLine/readline.pm
Installing /usr/local/share/perl5/5.40/Term/ReadLine/Perl.pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
ILYAZ/modules/Term-ReadLine-Perl-1.0303.tar.gz
/usr/bin/make install — OK

…………………
21 subroutines in Term::ReadLine redefined
Term::ReadLine のサブルーチンが再定義されました

cpan shell — CPAN exploration and modules installation (v2.36)
Enter ‘h’ for help.
——————
        Validate::IPモジュールインストール 
cpan[1]> install Data::Validate::IP
Data::Validate::IP is up to date (0.31).
        JSON::XSモジュールインストール     
cpan[2]>install JSON::XS
JSON::XS is up to date (4.04).

cpan[4]> exit

———————

[root@falcon21 ~]# yum -y localinstall awstats-8.0-1.noarch.rpm
scriptletの実行中: awstats-8.0-1.noarch 6/6

—– AWStats 8.0 – Laurent Destailleur —–
AWStats files have been installed in /usr/local/awstats

If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with awstats_configure.pl (or manually)
Step 2 : Build/Update Statistics with awstats.pl
Step 3 : Read Statistics



インストール済み:
awstats-8.0-1.noarch perl-Data-Validate-IP-0.31-6.el10_0.noarch
perl-JSON-XS-1:4.04-1.el10_0.x86_64 perl-NetAddr-IP-4.079-30.el10_0.x86_64
perl-Types-Serialiser-1.01-14.el10.noarch perl-common-sense-3.7.5-20.el10.x86_64

完了しました!


又は
[root@falcon21 ~]# rpm -ivh awstats-8.0-1.noarch.rpm

root@falcon21:~# rpm -i –replacepkgs awstats-8.0-1.noarch.rpm

—– AWStats 8.0 – Laurent Destailleur —–
AWStats files have been installed in /usr/local/awstats

If first install, follow instructions in documentation
(/usr/local/awstats/docs/index.html) to setup AWStats in 3 steps:
Step 1 : Install and Setup with awstats_configure.pl (or manually)
Step 2 : Build/Update Statistics with awstats.pl
Step 3 : Read Statistics
—————-

インストール先確認
[root@falcon21 ~]# ll /usr/local/awstats/
合計 16
-r–r–r– 1 root root 7041 8月 26 20:26 README.md
drwxr-xr-x 3 root root 4096 1月 24 14:16 docs
drwxr-xr-x 4 root root 4096 1月 24 14:16 tools
drwxr-xr-x 7 root root 69 1月 24 14:16 wwwroot

[root@falcon21 ~]# ll /usr/local/awstats/wwwroot
合計 0
drwxr-xr-x 5 root root 80 1月 24 14:16 cgi-bin
drwxr-xr-x 3 root root 42 1月 24 14:16 classes
drwxr-xr-x 2 root root 55 1月 24 14:16 css
drwxr-xr-x 9 root root 93 1月 24 14:16 icon
drwxr-xr-x 2 root root 37 1月 24 14:16 js

[root@falcon21 ~]# ll /usr/local/awstats/wwwroot/cgi-bin
合計 720
-rwxr-xr-x 1 root root 8659 8月 26 20:26 awredir.pl
-rwxr-xr-x 1 root root 711483 8月 26 20:26 awstats.pl
drwxr-xr-x 5 root root 4096 1月 24 14:16 lang
drwxr-xr-x 2 root root 4096 1月 24 14:16 lib
drwxr-xr-x 3 root root 4096 1月 24 14:16 plugins


            AWStats設定やり直し
Apache用AWStats設定ファイル初期化
[root@falcon21 ~]# rm -f /etc/httpd/conf.d/awstats.conf ; touch /etc/httpd/conf.d/awstats.conf 


AWStats設定スクリプト格納ディレクトリへ移動
[root@falcon21 ~]# cd /usr/local/awstats/ 

 AWStats設定スクリプト実行

[root@falcon21 awstats]# perl `rpm -ql awstats|grep “awstats_configure\.pl”` 

root@falcon21:/usr/local/awstats# perl `rpm -ql awstats|grep “awstats_configure\.pl”`

—– AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur —–
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
– You are not an administrator user,
– You want to analyze downloaded log files without web server,
– You want to analyze mail or ftp log files instead of web log files,
– You need to analyze load balanced servers log files,
– You want to ‘understand’ all possible ways to use AWStats…
Read the AWStats documentation (docs/index.html).

—–> Running OS detected: Linux, BSD or Unix

—–> Check for web server install

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path (‘none’ to skip web server setup):
> /etc/httpd/conf.d/awstats.conf
– This file does not exists.
Config file path (‘none’ to skip web server setup):
> /etc/httpd/httpd.conf
– This file does not exists.
Config file path (‘none’ to skip web server setup):
> none

Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)

—–> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

—–> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> falcon21.space

—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>

A SIMPLE config file has been created: /etc/awstats/awstats.falcon21.space.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for ‘falcon21.space’ with command:
> perl awstats.pl -update -config=falcon21.space
You can also build static report pages for ‘falcon21.space’ with command:
> perl awstats.pl -output=pagetype -config=falcon21.space

Press ENTER to finish…

———————

root@falcon21:/usr/local/awstats# perl `rpm -ql awstats|grep “awstats_configure\.pl”`

—– AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur —–
このツールは、AWStats を設定して単一の Web サーバーの統計情報を分析するのに役立ちます。
AWStats のセットアップで可能なすべての操作をこのツールで実行することもできますが、多くの場合、
ステップバイステップの手動セットアップドキュメント (docs/index.html) に従う方がよいでしょう。


特に以下の場合は、AWStats をご利用ください。
– 管理者権限を持たないユーザーの場合
– Web サーバーを使用せずにダウンロードしたログファイルを分析する場合
– Web ログファイルではなく、メールまたは FTP ログファイルを分析する場合
– 負荷分散サーバーのログファイルを分析する必要がある場合
– AWStats のあらゆる使用方法を「理解」したい場合…
AWStats のドキュメント (docs/index.html) をお読みください。

—–> 実行 OS が検出されました: Linux、BSD、または Unix

—–> Web サーバーのインストール状況を確認

Web サーバーの設定ファイルのフルパスを入力してください。
例: /etc/httpd/httpd.conf
例: /usr/local/apache2/conf/httpd.conf
例: c:\Program files\apache group\apache\conf\httpd.conf
設定ファイルのパス (Web サーバーのセットアップをスキップする場合は「none」):
/etc/httpd/conf/httpd.conf


Webサーバーの設定ファイルが見つかりません。
レポートを動的に作成したい場合は、AWStatsスクリプトをCGIとして宣言するようにWebサーバーを手動でセットアップする必要があります。
AWStatsのセットアップドキュメント(ファイル docs/index.html)を参照してください。

—–> 新しい設定ファイルを作成する必要がありますか?
AWStatsの新しい設定/プロファイルファイルを作成しますか?(初回インストールの場合は必須)[y/N] ? y

—–> 作成する設定ファイル名を指定してください
Webサイトまたはプロファイル分析の名前は何ですか?

例: www.mysite.com
例: デモ
Web サイト、仮想サーバー、またはプロファイル名:
falcon21.space

–> 設定ファイルのパスを定義する
設定ファイルをどのディレクトリに保存する予定ですか?
デフォルト: /etc/awstats

設定ファイルを保存するディレクトリ パス (デフォルトの場合は Enter):
>Enter

—–> 設定ファイル ‘/etc/awstats/awstats.falcon21.space.conf’ を作成します
設定ファイル /etc/awstats/awstats.falcon21.space.conf が作成されました。

—–> スケジューラ内に更新プロセスを追加します
申し訳ございませんが、configure.pl はまだ cron への自動追加をサポートしていません。
次のコマンドを cron に追加することで手動で実行できます:
/root/wwwroot/cgi-bin/awstats.pl -update -config=falcon21.space


再設定時
You can then manually update your statistics for ‘falcon21.space’ with command:
> perl awstats.pl -update -config=falcon21.space
You can also read your statistics for ‘falcon21.space’ with URL:
> http://localhost/awstats/awstats.pl?config=falcon21.space


または、複数の設定ファイルがあり、1 つのコマンドのみで実行したい場合は、次のコマンドを実行してください:
/root/tools/awstats_updateall.pl


NTER キーを押して続行してください…

シンプルな設定ファイル /etc/awstats/awstats.falcon21.space.conf が作成されました。
設定ファイルの内容を確認し、主要なパラメータを手動で変更してください。
以下のコマンドで「falcon21.space」の統計情報を手動で更新できます。
> perl awstats.pl -update -config=falcon21.space

[root@falcon21 ~]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=falcon21.space



以下のコマンドで「falcon21.space」の静的レポートページを作成することもできます。
perl awstats.pl -output=pagetype -config=falcon21.space

[root@falcon21 ~]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -output=pagetype -config=falcon21.space


[root@falcon21 ~]# crontab -e
00 02 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=falcon21.space
05 02 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -output=pagetype -config=falcon21.space



ENTER キーを押して終了してください。



W緑ラベルディスクの場合
[root@falcon21 awstats]# perl `rpm -ql awstats|grep “awstats_configure\.pl”
> ^C
[root@falcon21 awstats]# perl `rpm -ql awstats|grep “awstats_configure\.pl”‘
> ^C
[root@falcon21 awstats]# perl `rpm -ql awstats|grep “awstats_configure\.pl”`

—– AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur —–
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
– You are not an administrator user,
– You want to analyze downloaded log files without web server,
– You want to analyze mail or ftp log files instead of web log files,
– You need to analyze load balanced servers log files,
– You want to ‘understand’ all possible ways to use AWStats…
Read the AWStats documentation (docs/index.html).

—–> Running OS detected: Linux, BSD or Unix

—–> Check for web server install

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path (‘none’ to skip web server setup):
> /etc/httpd/conf/httpd.conf

—–> Check and complete web server config file ‘/etc/httpd/conf/httpd.conf’
All AWStats directives are already present.

—–> Update model config file ‘/etc/awstats/awstats.model.conf’
File awstats.model.conf updated.

—–> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

—–> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> falcon21.space

—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>
Warning: A config file for this name already exists. Choose another one. 
    ***設定ファイルをコピーしたからファイルがあり 別名で作成:***
Your web site, virtual server or profile name:
> falcon21

—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>Enter

—–> Create config file ‘/etc/awstats/awstats.falcon21.conf’
Config file /etc/awstats/awstats.falcon21.conf created.

—–> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=falcon21
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue…
Enter

A SIMPLE config file has been created: /etc/awstats/awstats.falcon21.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for ‘falcon21’ with command:
perl awstats.pl -update -config=falcon21
You can also read your statistics for ‘falcon21’ with URL:
http://localhost/awstats/awstats.pl?config=falcon21

Press ENTER to finish…

———

[root@falcon21 ~]# ll /etc/awstats
合計 256
-rw-r–r– 1 root root 64663 2月 1 17:53 awstats.falcon21.conf
-rw-r–r–. 1 root root 64784 1月 22 12:07 awstats.falcon21.space.conf
-rw-r–r– 1 root root 64655 2月 1 17:51 awstats.model.conf
-rw-r–r–. 1 root root 64655 1月 24 14:26 awstats.model.conf.rpmorig


確認


[root@falcon21 ~]# ll /etc/awstats
合計 128
-rw-r–r– 1 root root 64781 1月 26 00:39 awstats.falcon21.space.conf
-rw-r–r– 1 root root 64647 1月 26 00:01 awstat
s.model.conf


設定ファイルconfig file 編集

  /etc/awstats/awstats.falcon21.space.conf

[root@falcon21 ~]# vi /etc/awstats/awstats.falcon21.space.conf

51 LogFile=”/var/log/httpd/access_log”

159 SiteDomain=”falcon21.space”

174 HostAliases=”falcon21.space 192.168.10.3 127.0.0.1 localhost”


192 # Default: 2
193 #
194 DNSLookup=2


225 DirData=”.”

338 SkipDNSLookupFor=”192.168.10.3 REGEX[^192\.168\.]”

487 SkipHosts=”127.0.0.1 localhost REGEX[^192\.168\.10\.]”

1457 LoadPlugin=”geoipfree”

1626 UseHTTPSLinkForUrl=”/”



以下のコマンドで「falcon21.space」の統計情報を手動で更新できます。
perl awstats.pl -update -config=falcon21.space

root@falcon21:~# perl awstats.pl -update -config=falcon21.space
Can’t open perl script “awstats.pl”: そのようなファイルやディレクトリはありません

———————

統計情報を手動で更新

root@falcon21:~# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=falcon21.space
Create/Update database for config “/etc/awstats/awstats.falcon21.space.conf” by AWStats version 8.0 (build 20240604)
From data in log file “/var/log/httpd/access_log”…

Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
Jumped lines in file: 0
Parsed lines in file: 0
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.

以下のコマンドで「falcon21.space」の静的レポートページを作成することもできます。
perl awstats.pl -output=pagetype -config=falcon21.space

「falcon21.space」の静的レポートページを作成

root@falcon21:~# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -output=pagetype -config=falcon21.space
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html lang=”en”>
<head>
<meta name=”generator” content=”AWStats 8.0 (build 20240604) from config file awstats.falcon21.space.conf (http://www.awstats.org)”>
<meta name=”robots” content=”noindex,nofollow”>
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″>
<meta http-equiv=”description” content=”Awstats – Advanced Web Statistics for falcon21.space (2026-01) – pagetype”>
<title>Statistics for falcon21.space (2026-01) – pagetype</title>
<style type=”text/css”>
body { font: 1.2em verdana, arial, helvetica, sans-serif; background-color: #FFFFFF; margin-top: 0; margin-bottom: 0; }
.aws_bodyl { }
.aws_border { border-collapse: collapse; background-color: #CCCCDD; padding: 1px 1px 1px 1px; margin-top: 0px; margin-bottom: 0px; }
.aws_title { font: 1em verdana, arial, helvetica, sans-serif; font-weight: bold; background-color: #CCCCDD; text-align: center; margin-top: 0; margin-bottom: 0; padding: 5px; color: #000000; }
.aws_blank { font: 13px verdana, arial, helvetica, sans-serif; background-color: #FFFFFF; text-align: center; margin-bottom: 0; padding: 1px 1px 1px 1px; }
.aws_data {
background-color: #FFFFFF;
border-top-width: 1px;
border-left-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
}
.aws_formfield { font: 13px verdana, arial, helvetica; }
.aws_button {
font-family: arial,verdana,helvetica, sans-serif;
font-size: 12px;
border: 1px solid #ccd7e0;
background-image : url(/icon/other/button.gif);
}
th { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 2px 1px 1px; font: 11px verdana, arial, helvetica, sans-serif; text-align:center; color: #000000; }
th.aws { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; padding: 1px 2px 1px 1px; font-size: 13px; font-weight: bold; }
td { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; font: 0.9em verdana, arial, helvetica, sans-serif; text-align:center; color: #000000; }
td.aws { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; text-align:left; color: #000000; padding: 6px;}
td.awsm { border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; font: 0.8em verdana, arial, helvetica, sans-serif; text-align:left; color: #000000; padding: 0px; }
b { font-weight: bold; }
a:link { color: #0011BB; text-decoration: none; }
a:visited { color: #0011BB; text-decoration: none; }
a:hover { color: #605040; text-decoration: underline; }
.aws_data th { font-size: 0.9em; padding: 5px; }
.currentday { font-weight: bold; }
</style>
</head>

<body style=”margin-top: 0px”>
<a name=”top”></a>



<a name=”menu”>&nbsp;</a>
<form name=”FormDateFilter” action=”/cgi-bin/awstats.pl?output=pagetype&amp;config=falcon21.space” style=”padding: 0px 0px 20px 0px; margin-top: 0″>
<table class=”aws_border” border=”0″ cellpadding=”2″ cellspacing=”0″ width=”100%”>
<tr><td>
<table class=”aws_data sortable” border=”0″ cellpadding=”1″ cellspacing=”0″ width=”100%”>
<tr><td class=”aws” valign=”middle”><b>Statistics for:</b>&nbsp;</td><td class=”aws” valign=”middle”><span style=”font-size: 14px;”>falcon21.space</span></td><td align=”right” rowspan=”3″><a href=”https://www.awstats.org” target=”awstatshome”><img src=”/icon/other/awstats_logo6.png” border=”0″ alt=’Awstats Web Site’ title=’Awstats Web Site’ /></a><br /></td></tr>
<tr valign=”middle”><td class=”aws” valign=”middle” width=”150″><b>Last Update:</b>&nbsp;</td><td class=”aws” valign=”middle”><span style=”font-size: 12px;”><span style=”color: #880000″>Never updated (See ‘Build/Update’ on awstats_setup.html page)</span></span></td></tr>
<tr><td class=”aws” valign=”middle”><b>Reported period:</b></td><td class=”aws” valign=”middle”><select class=”aws_formfield” name=”databasebreak”>
<option selected=”selected” value=”month”>Month</option>
<option value=”day”>Day</option>
<option value=”hour”>Hour</option>
</select>
<select class=”aws_formfield” name=”month”>
<option selected=”selected” value=”01″>Jan</option>
<option value=”02″>Feb</option>
<option value=”03″>Mar</option>
<option value=”04″>Apr</option>
<option value=”05″>May</option>
<option value=”06″>Jun</option>
<option value=”07″>Jul</option>
<option value=”08″>Aug</option>
<option value=”09″>Sep</option>
<option value=”10″>Oct</option>
<option value=”11″>Nov</option>
<option value=”12″>Dec</option>
<option value=”all”>- Year -</option>
</select>
<select class=”aws_formfield” name=”year”>
<option selected=”selected” value=”2026″>2026</option>
</select>
<input type=”hidden” name=”output” value=”pagetype” />
<input type=”hidden” name=”config” value=”falcon21.space” />
<input type=”submit” value=” OK ” class=”aws_button” /></td></tr>
</table>
</td></tr></table>
</form><br />

<table>
<tr><td class=”aws”><a href=”javascript:parent.window.close();”>Close window</a></td></tr>
</table>

***********************************************************************

       Geo::IPfreeモジュールインストール
      ————————————————

perl-CPANインストール
[root@falcon21 ~]# yum -y install perl-CPAN
メタデータの期限切れの最終確認: 0:58:25 前の 2025年11月13日 08時26分13秒 に実施しました。
パッケージ perl-CPAN-2.36-514.el10_0.noarch は既にインストールされています。
依存関係が解決しました。
行うべきことはありません。
完了しました!


perl-CPAN起動   Geo::IPfreeモジュールインストール
[root@falcon21 ~]# perl -MCPAN -e shell  

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer ‘no’ below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] ← 空ENTER

Perl site library directory “/usr/local/share/perl5/5.40” does not exist.
Perl site library directory “/usr/local/share/perl5/5.40” created.
Perl site library directory “/usr/local/lib64/perl5/5.40” does not exist.
Perl site library directory “/usr/local/lib64/perl5/5.40” created.
We initialized your ‘urllist’ to https://cpan.org/. Type ‘o conf init urllist’ to change it.

Autoconfiguration complete.

commit: wrote ‘/root/.local/share/.cpan/CPAN/MyConfig.pm’

You can re-run configuration any time with ‘o conf init’ in the CPAN shell
Terminal does not support AddHistory.

To fix that, maybe try> install Term::ReadLine::Perl


cpan shell — CPAN exploration and modules installation (v2.36)
Enter ‘h’ for help.

cpan[1]>install Geo::IPfree ← Geo::IPfreeモジュールインストール

Reading ‘/root/.local/share/.cpan/Metadata’
Database was generated on Wed, 21 Jan 2026 16:41:01 GMT
Fetching with HTTP::Tiny:
https://cpan.org/authors/01mailrc.txt.gz
Reading ‘/root/.local/share/.cpan/sources/authors/01mailrc.txt.gz’
………………………………………………………………….DONE
Fetching with HTTP::Tiny:
https://cpan.org/modules/02packages.details.txt.gz
Reading ‘/root/.local/share/.cpan/sources/modules/02packages.details.txt.gz’
Database was generated on Sun, 25 Jan 2026 15:29:02 GMT
…………..
New CPAN.pm version (v2.38) available.
[Currently running version is v2.36]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.


……………………………………………………..DONE
Fetching with HTTP::Tiny:
https://cpan.org/modules/03modlist.data.gz
Reading ‘/root/.local/share/.cpan/sources/modules/03modlist.data.gz’
DONE
Writing /root/.local/share/.cpan/Metadata
Geo::IPfree is up to date (1.160000).

cpan[2]> quit
Lockfile removed.

cpan[2]> quit ← perl-CPAN終了

  AWStatsデータベース作成       
(1)AWStatsデータベース初期作成
Apacheのログファイルを過去分も含めて全てAWStatsのデータベースに取り込む 
AWStatsデータベース初期作成スクリプト作成 [root@falcon21 ~]# vi awstatsinit.sh #!/bin/bash # データベース作成先ディレクトリ作成 mkdir -p `grep ^DirData /etc/awstats/awstats.$1.conf | awk -F= ‘{print $2}’|tr -d \”` # AWStats設定ファイルよりApacheログファイル名取得 logfile=`grep ^LogFile /etc/awstats/awstats.$1.conf|sed -e ‘s/LogFile=”\([^ ]*\)”/\1/p’ -e d` # 過去ログを古い順に処理 grep dateext /etc/logrotate.conf > /dev/null 2>&1 if [ $? -eq 0 ]; then ls $logfile-* > /dev/null 2>&1 if [ $? -eq 0 ]; then # 過去ログファイル名に日付が設定されている場合 for log in `ls $logfile-*|sort` do `rpm -ql awstats|grep “awstats\.pl”` \ -config=$1 -update -logfile=$log done fi else ls $logfile.* > /dev/null 2>&1 if [ $? -eq 0 ]; then # 過去ログファイル名に通番が設定されている場合 for log in `ls $logfile.*|sort -r` do `rpm -ql awstats|grep “awstats\.pl”` \ -config=$1 -update -logfile=$log done fi fi # 現在ログ処理 for log in `ls $logfile|sort` do `rpm -ql awstats|grep “awstats\.pl”` \ -config=$1 -update -logfile=$log done
———————–

awstatsinit.shに実行権を付与

[root@falcon21 ~]# chmod 700 awstatsinit.sh

———————-


AWStatsデータベース初期作成スクリプト実行
[root@falcon21 ~]# sh awstatsinit.sh falcon21.space 
Create/Update database for config “/etc/awstats/awstats.falcon21.space.conf” by AWStats version 8.0 (build 20240604)
From data in log file “/var/log/httpd/access_log-20260118″…
Phase 1 : First bypass old records, searching new record…
Direct access after last parsed record (after line 3)
Jumped lines in file: 3
Found 3 already parsed records.
Parsed lines in file: 0
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
Create/Update database for config “/etc/awstats/awstats.falcon21.space.conf” by AWStats version 8.0 (build 20240604)
From data in log file “/var/log/httpd/access_log”…
Phase 1 : First bypass old records, searching new record…
Direct access to last remembered record is out of file.
So searching it from beginning of log file…
Jumped lines in file: 0
Parsed lines in file: 0
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.


—————-

AWStatsデータベース初期作成スクリプト削除
[root@falcon21 ~]# rm -f awstatsinit.sh  

又は
[root@falcon21 ~]# mv awstatsinit.sh awstatsinit.sh.bk


AWStatsデータベース自動更新設定スクリプト作成
[root@falcon21 ~]# vi /etc/cron.daily/awstats  
#!/bin/bash
for conf in `ls /etc/awstats/|grep -v awstats.falcon21.space.conf`
do
site=`echo $conf|sed -e ‘s/awstats\.\([^ ]*\)\.conf/\1/p’ -e d`
`rpm -ql awstats|grep “awstats\.pl”` -config=$site -update > /dev/null
done

———————-

AWStatsデータベース自動更新設定スクリプトへ実行権限付加
[root@falcon21 ~]# chmod +x /etc/cron.daily/awstats 


(2)Apacheログローテーション設定 
Apacheログファイル切替え時、AWStatsのデータベースに取り込んでから切替えを行うようにする
Apacheログローテーション設定ファイル編集 [root@falcon21 ~]# vi /etc/logrotate.d/httpd   /var/log/httpd/*log { missingok notifempty sharedscripts ----追加(ここから)---- prerotate `rpm -ql awstats|grep “awstats_updateall\.pl”` now -confdir=”/etc/awstats” \ -awstatsprog=”`rpm -ql awstats|grep “awstats\.pl”`” >/dev/null endscript ----追加(ここまで)---- delaycompress postrotate /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true endscript }
(3)Apache設定   Apache用AWStats設定ファイル編集 [root@falcon21 ~]# vi /etc/httpd/conf.d/awstats.conf   <Directory “/usr/local/awstats/wwwroot”> Options None AllowOverride None Require all granted ← 追加(Order句、Allow句のApache2.4変更対応) #Order allow,deny ← 行頭に#を追加してコメントアウト #Allow from all ← 行頭に#を追加してコメントアウト </Directory> Apache設定反映 [root@centos ~]# systemctl reload httpd 
AWStats確認
https://falcon21.space/awstats/awstats.plへアクセスしてアクセス統計ページが表示されることを確認  

 https://falcon21.space/awstats/awstats.pl?config=falcon21.space  OK!! 

 
***********************************************************************
awstats.plアクセス制限  vi /etc/httpd/conf.d/awstats.conf
Apache用AWStats設定ファイル編集 [root@falcon21 ~]# vi /etc/httpd/conf.d/awstats.conf   以下を最終行へ追加 <Files “awstats.pl”> Require all denied Require ip 127.0.0.1 Require ip 192.168.10.0/24 ← 内部ネットワークアドレスを指定 </Files>
(3)Apache設定反映
Apache設定反映
[root@falcon21 ~]# systemctl restart httpd 


https://falcon21.space/awstats/awstats.pl?config=falcon21.space   OK!! 

メールリポート


2026年1月27日 10:02:54
Create/Update database for config “/etc/awstats/awstats.falcon21.space.conf” by AWStats version 8.0 (build 20240604)
From data in log file “/var/log/httpd/access_log“…
Phase 1 : First bypass old records, searching new record…
Direct access to last remembered record is out of file.
So searching it from beginning of log file…
Jumped lines in file: 0
Parsed lines in file: 2
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 2 corrupted records,
Found 0 old records,
Found 0 new qualified records.