본문 바로가기

* 리눅스

[linux] How To Install webalizer on CentOS 8

반응형

How To Install webalizer on CentOS 8

webalizer

 - A flexible Web server log file analysis program

installation environment

$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

$ getconf LONG_BIT
64

install webalizer

$ yum install -y webalizer

webalizer package contents

$ rpm -ql webalizer
/etc/cron.daily/00webalizer
/etc/httpd/conf.d/webalizer.conf
/etc/sysconfig/webalizer
/etc/webalizer.conf
/usr/bin/wcmgr
/usr/bin/webalizer
/usr/bin/webazolver
/usr/lib/.build-id
/usr/lib/.build-id/54
/usr/lib/.build-id/54/9240ea29b409c15620555f380e54c944d91cd1
/usr/lib/.build-id/eb
/usr/lib/.build-id/eb/ec64031872167daab460de72dee50ad742e60e
/usr/share/doc/webalizer
/usr/share/doc/webalizer/README
/usr/share/man/man1/wcmgr.1.gz
/usr/share/man/man1/webalizer.1.gz
/usr/share/man/man1/webazolver.1.gz
/var/lib/webalizer
/var/www/usage
/var/www/usage/msfree.png
/var/www/usage/webalizer.png

webalizer version infomation

$ webalizer -V
Webalizer V2.23-08 (Linux 4.18.0-193.28.1.el8_2.x86_64 x86_64) English
Copyright 1997-2013 by Bradford L. Barrett

webalizer run

$ webalizer -r http://www.scbyun.com -n www.scbyun.com -o /docker-container/docker-nginx/html/serv-01 /tmp/access.log

webalizer configuring

$ cd /docker-container/docker-nginx/html

$ mkdir {serv-01,serv-02,serv-03,serv-04,serv-05,serv-06}
$ vim serv-01/webalizer.conf
LogFile /tmp/access.log

OutputDir /docker-container/docker-nginx/html/serv-01

HistoryName /docker-container/docker-nginx/html/serv-01/webalizer.hist

Incremental yes
IncrementalName	/docker-container/docker-nginx/html/serv-01/webalizer.current

ReportTitle scbyun.com Usage Statistics for

HostName serv-01

ReallyQuiet yes

PageType	htm*
PageType	cgi
PageType        php
PageType        shtml
DNSCache        /docker-container/docker-nginx/html/serv-01/dns_cache.db
DNSChildren	10
Quiet		yes
FoldSeqErr	yes
CountryGraph	yes
HideURL		*.gif
HideURL		*.GIF
HideURL		*.jpg
HideURL		*.JPG
HideURL		*.png
HideURL		*.PNG
HideURL		*.ra
SearchEngine	yahoo.com	p=
SearchEngine	altavista.com	q=
SearchEngine	google.com	q=
SearchEngine	eureka.com	q=
SearchEngine	lycos.com	query=
SearchEngine	hotbot.com	MT=
SearchEngine	msn.com		MT=
SearchEngine	infoseek.com	qt=
SearchEngine	webcrawler	searchText=
SearchEngine	excite		search=
SearchEngine	netscape.com	search=
SearchEngine	mamma.com	query=
SearchEngine	alltheweb.com	query=
SearchEngine	northernlight.com  qr=
$ webalizer -c /docker-container/docker-nginx/html/serv-01/webalizer.conf

이미지 출처-https://linuxreviews.org/Webalizer

webalizer.sh scripte create

$ vim webalizer.sh
#!/bin/bash

YestDay=`date --date="-1 days" +"%Y%m%d"`
ConfDir=/docker-container/docker-nginx/html
Web_Server_Name="
serv-01
serv-02
serv-03
serv-04
serv-05
serv-06
"

for servername in $Web_Server_Name; do
	echo "hostname" $servername
	zcat /logs/access/$servername-www.scbyun.com-access-$YestDay.log.gz > /tmp/access.log
	webalizer -c $ConfDir/$servername/webalizer.conf
	rm -f /tmp/access.log
done

docker rm -f nginx-webalizer

docker run -d -p 8080:80 --rm -v /docker-container/docker-nginx/html:/usr/share/nginx/html:ro --name nginx-webalizer nginx
$ chmod +x /docker-container/docker-nginx/webalizer.sh
$ crontab -e
###webalizer
10 09 * * *	/bin/bash /docker-container/docker-nginx/webalizer.sh > /dev/null 2>&1
728x90
반응형