# ただし、変更する意義は余り無いと言うか、別ディレクトリを指定している場面を見た事は無い
/etc/webalizer/webalizer.conf.html 等の統計結果の保存先は、標準で以下に配置される
/var/www/webalizer# こちらは、標準のディレクトリでは支障が生じる人も いるかも知れない
apt-get install webalizer日本語表示は不要という事で あれば、東風(こち) True Type Font は不要か
apt-get install ttf-kochi-gothic
(若しくは apt-get install ttf-kochi-mincho)
cd /etc/webalizer
cp -p webalizer.conf webalizer.conf.org
vi webalizer.conf
# LogFile defines the web server log file to use. If not specified統計算出の対象と する accesslog ファイルの指定、と言う事か
# here or on on the command line, input will default to STDIN. If
# the log filename ends in '.gz' (a gzip compressed file), or '.bz2'
# (bzip2 compressed file), it will be decompressed on the fly as it
# is being read.
LogFile /var/log/apache2/access.log.1
変更後設定
LogFile /var/log/apache2/access.log
# LogType defines the log type being processed. Normally, the Webalizer統計算出の対象と するログファイルの型式指定、と言う事か
# expects a CLF or Combined web server log as input. Using this option,
# you can process ftp logs (xferlog as produced by wu-ftp and others),
# Squid native logs or W3C extended format web logs. Values can be 'clf',
# 'ftp', 'squid' or 'w3c'. The default is 'clf'.
#LogType clf
# OutputDir is where you want to put the output files. This should統計結果の格納先を記述する
# should be a full path name, however relative ones might work as well.
# If no output directory is specified, the current directory will be used.
OutputDir /var/www/webalizer
# HistoryName allows you to specify the name of the history file produced統計算出履歴ファイル、とでも言うべきか
# by the Webalizer. The history file keeps the data for previous months,
# and is used for generating the main HTML page (index.html). The default
# is a file named "webalizer.hist", stored in the output directory being
# used. The name can include a path, which will be relative to the output
# directory unless absolute (starts with a leading '/').
#HistoryName webalizer.hist
# Incremental processing allows multiple partial log files to be used増分加算集計の手法指定、とでも表記すれば良いか
# instead of one huge one. Useful for large sites that have to rotate
# their log files more than once a month. The Webalizer will save its
# internal state before exiting, and restore it the next time run, in
# order to continue processing where it left off. This mode also causes
# The Webalizer to scan for and ignore duplicate records (records already
# processed by a previous run). See the README file for additional
# information. The value may be 'yes' or 'no', with a default of 'no'.
# The file 'webalizer.current' is used to store the current state data,
# and is located in the output directory of the program (unless changed
# with the IncrementalName option below). Please read at least the section
# on Incremental processing in the README file before you enable this option.
#Incremental no
変更後設定
Incremental yes
# IncrementalName allows you to specify the filename for saving the増分加算集計の現状状態を保持しているファイル名を指定
# incremental data in. It is similar to the HistoryName option where the
# name is relative to the specified output directory, unless an absolute
# filename is specified. The default is a file named "webalizer.current"
# kept in the normal output directory. If you don't specify "Incremental"
# as 'yes' then this option has no meaning.
#IncrementalName webalizer.current
OutputDir /var/www/webalizerが利用される
root:/var/www/webalizer# more webalizer.current
# Webalizer V2.23-05 Incremental Data - 06/02/2014 09:43:47
2014 6 2 9 43 47
- 省略 -
# -usernames-
# End Of Table - usernames
# ReportTitle is the text to display as the title. The hostname統計結果の最上部に表示される名称を指定
# (unless blank) is appended to the end of this string (seperated with
# a space) to generate the final full title string.
# Default is (for english) "Usage Statistics for".
ReportTitle Usage statistics for
# HostName defines the hostname for the report. This is used in統計結果のホスト名を指定と あるが、ホスト名では なく公開している Webサーバの FQDN 名を記述した方が良いか
# the title, and is prepended to the URL table items. This allows
# clicking on URLs in the report to go to the proper location in
# the event you are running the report on a 'virtual' web server,
# or for a server different than the one the report resides on.
# If not specified here, or on the command line, webalizer will
# try to get the hostname via a uname system call. If that fails,
# it will default to "localhost".
#HostName www.webalizer.org
# HTMLExtension allows you to specify the filename extension to use統計結果ファイルの拡張子を指定、と言う事か
# for generated HTML pages. Normally, this defaults to "html", but
# can be changed for sites who need it (like for PHP embeded pages).
#HTMLExtension html
# PageType lets you tell the Webalizer what types of URLs youPageType(拡張子) の対象指定と除外、と言う事か
# consider a 'page'. Most people consider html and cgi documents
# as pages, while not images and audio files. If no types are
# specified, defaults will be used ('htm*', 'cgi' and HTMLExtension
# if different for web logs, 'txt' for ftp logs).
PageType htm*
PageType cgi
#PageType phtml
PageType php3
#PageType pl
PageType php
# UseHTTPS should be used if the analysis is being run on aHTTPS 形態での統計選択の指定、と言う事か
# secure server, and links to urls should use 'https://' instead
# of the default 'http://'. If you need this, set it to 'yes'.
# Default is 'no'. This only changes the behaviour of the 'Top
# URLs' table.
#UseHTTPS no
# DNSCache specifies the DNS cache filename to use for reverse DNS lookups.逆引き DNS 結果の保持用データベースファイル名の指定、のみ ならず DNS 逆引きの動作指定
# This file must be specified if you wish to perform name lookups on any IP
# addresses found in the log file. If an absolute path is not given as
# part of the filename (ie: starts with a leading '/'), then the name is
# relative to the default output directory. See the DNS.README file for
# additional information.
#DNSCache dns_cache.db
DNSCache dns_cache.dbデータベースファイルのディレクトリは上記の
OutputDir /var/www/webalizerが利用されるが、このデータベースファイルは絶対パス(path) 指定が可能で ある らしい
# DNSChildren allows you to specify how many "children" processes are逆引き DNS を行う際の子プロセス(processes) 数の指定、と言う事か
# run to perform DNS lookups to create or update the DNS cache file.
# If a number is specified, the DNS cache file will be created/updated
# each time the Webalizer is run, immediately prior to normal processing,
# by running the specified number of "children" processes to perform
# DNS lookups. If used, the DNS cache filename MUST be specified as
# well. The default value is zero (0), which disables DNS cache file
# creation/updates at run time. The number of children processes to
# run may be anywhere from 1 to 100, however a large number may effect
# normal system operations. Reasonable values should be between 5 and
# 20. See the DNS.README file for additional information.
#DNSChildren 0
# CacheIPs allows unresolved IP addresses to be cached in the DNSDNS で逆引き応答が得られない IPアドレスの保持手法指定、と言う事か
# database. Normally, only resolved addresses are saved. At some
# sites, particularly those with a large number of unresolvable IP
# addresses visiting, it may be useful to enable this feature so
# those addresses are not constantly looked up each time the program
# is run. Values can be 'yes' or 'no', with 'no' being the default.
#CacheIPs no
# CacheTTL specifies the time to live (TTL) value for cached DNS逆引き DNS データベースの保持期間を指定
# entries, in days. This value may be anywhere between 1 and 100
# with the default being 7 days (1 week).
#CacheTTL 7
# HTMLHead defines HTML code to insert within the <HEAD></HEAD>HTML ヘッダに関する個別指定行が必要な場合に指定を追加
# block, immediately after the <TITLE> line. Maximum line length
# is 80 characters, so use multiple lines if needed.
#HTMLHead
#HTMLHead
# IgnoreState also shouldn't be used, but is here anyway. It is現状統計結果の無視指定、とでも表記すれば良いか
# similar to the IgnoreHist option, but for the incremental data
# file. If this is set to 'yes', any existing incrememtal data
# will be ignored and a new data file will be written at the end
# of processing. USE WITH CAUTION. By ignoring an existing
# incremental data file, all previous processing for the current
# month will be lost, and those logs must be re-processed.
# Valid values are "yes" or "no". Default is "no".
#IgnoreState no
LogFile /var/log/apache2/access.log本機能の有用性が良く分からないが、そう言うものか
# Your own site should be hidden機能が良く分からず、把握しにくい
#HideSite *webalizer.org
#HideSite localhost
# Your own site gives most referrals機能が良く分からず、把握しにくい
#HideReferrer webalizer.org/
# Usually you want to hide these統計結果からの表示除外を意図する対象公開ファイルの拡張子を指定
HideURL *.gif
HideURL *.GIF
HideURL *.jpg
HideURL *.JPG
HideURL *.png
HideURL *.PNG
HideURL *.ra
# Hiding agents is kind of futile統計結果からの表示除外を意図する対象エージェント(user agent)名称を指定
#HideAgent RealPlayer
# The Ignore* keywords allow you to completely ignore log records based統計算出から除外したい各種内容を指定
# on hostname, URL, user agent, referrer or username. I hesitated in
# adding these, since the Webalizer was designed to generate _accurate_
# statistics about a web servers performance. By choosing to ignore
# records, the accuracy of reports become skewed, negating why I wrote
# this program in the first place. However, due to popular demand, here
# they are. Use the same as the Hide* keywords, where the value can have
# a leading or trailing wildcard '*'. Use at your own risk ;) Please
# remember, the use of these will MAKE YOUR STATS INACCURATE and you
# should consider using an equivalent 'Hide*' keyword instead.
#IgnoreSite bad.site.net
IgnoreSite localhost
#IgnoreURL /test*
#IgnoreReferrer file:/*
IgnoreReferrer localhost
#IgnoreAgent RealPlayer
#IgnoreUser root
#TrueTypeFont日本語フォントを指定
TrueTypeFont /usr/share/fonts/truetype/kochi/kochi-gothic.ttf通常の運用で あれば、見るべき箇所は この位で あろうか
(明朝体書体を導入している場合は以下の様に指定
TrueTypeFont /usr/share/fonts/truetype/kochi/kochi-mincho.ttf)
cd /etc/apache2
cp -p apache2.conf apache2.conf.[日付適当に]
vi apache2.conf
変更前
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
変更後ここで一旦 Apache を停止
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combined
/etc/init.d/apache2 stop既存の access.log ファイルのローテート連番を増数して おく
(service apache2 stop でも良い)
cd /var/log/apache2ファイル数が多い場合、手作業対応では誤作業も発生し易いので、簡易にシェルスクリプトを書いて対応した方が無難か
mv access.log.50.gz access.log.51.gz
mv access.log.49.gz access.log.50.gz
- 省略 -
mv access.log.2.gz access.log.3.gz
gzip access.log.1
mv access.log.1.gz access.log.2.gz
mv access.log access.log.1
/etc/init.d/apache2 start
(service apache2 start でも良い)
webalizer /var/log/apache2/access.log.51.gzまとめて一度に実行しても概(おおむ)ね問題無いと思うが、場合に よっては不整合レコードが発生する可能性も あるので、一行毎に実行し他方が確実か
webalizer /var/log/apache2/access.log.50.gz
- 省略 -
webalizer /var/log/apache2/access.log.2.gz
webalizer /var/log/apache2/access.log.1
webalizerここで、上記の
OutputDir /var/www/webalizerで指定したディレクトリを URI として Web ブラウザで表示させる
http://www.example.com/webalizer/統計結果が正常に表示されれば成功
-rwxr-xr-x 1 root root 1491 2月 6 2012 webalizercrontab を見る限り、毎日 6:25 に /usr/bin/webalizer が自動実行される事に なる
root:/etc# more crontab場合に よっては適宜変更したい人も いるかも知れない
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#