Fedora36:ログ解析設定

s50

Webアクセスログ解析(AWStats)のインストール.

AWStatsをインストールします。

[root@www ~]# 50_1dnf -y install awstats

s51自動作成されているファイルを設定します。

[root@www ~]# 51_1vi /etc/awstats/awstats.fedoraserver.jp.conf

s52126行目:変更します。

LogFormat=52_11

s53157行目:ホスト名を設定します。

SiteDomain=53_1"fedoraserver.jp"

s54172行目:除外したいドメイン名やIPアドレスを追記します。

HostAliases=54_1"localhost 127.0.0.1 REGEX[^.*fedoraserver\.jp$] REGEX[^192\.168\.1\.]"

s55ファイルを設定します。

[root@www ~]# 55_1vi /etc/httpd/conf.d/awstats.conf

s5630行目:アクセス許可IPを追記します。

56_1        Require ip 192.168.1.1/24

s57再起動します。

[root@www ~]# 57_1systemctl restart httpd

s581時間毎に自動更新する設定をします。

[root@www ~]# 58_1/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=fedoraserver.jp -update

s59Web ブラウザを起動し、「awstats」にアクセスして、作動確認します。

http://fedoraserver.jp/awstats/awstats.pl

awstats
s60

メールログ解析(Pfiogsumm)のインストール.

pflogsumm をインストールします。

[root@www ~]# 60_1dnf -y install postfix-perl-scripts

s61メールログのサマリーを出力します。

[root@www ~]# 61_1perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
Postfix log summaries for Jul 29

Grand Totals
------------
messages

      8   received
      8   delivered
      2   forwarded
      1   deferred  (1  deferrals)
      0   bounced
      0   rejected (0%)
      0   reject warnings
      0   held
      0   discarded (0%)

   2428k  bytes received
   2429k  bytes delivered
      3   senders
      2   sending hosts/domains
      2   recipients
      2   recipient hosts/domains


Per-Hour Traffic Summary
------------------------
    time          received  delivered   deferred    bounced     rejected
    --------------------------------------------------------------------
    0000-0100           0          0          0          0          0
    0100-0200           0          0          0          0          0
    0200-0300           0          0          0          0          0
…

s62root宛てにメール送信する設定をします。

[root@www ~]# 62_1crontab -e

s63毎日午前1時にメール送信する設定をします。

[root@www ~]# 63_100 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' root

コメント

タイトルとURLをコピーしました