centOS 7 apache log 通过 AWStats 访问

awstats 可以通过apache 部署,关联指定格式的日志文件(apache,nginx),然后通过网页的形式展现出来,便于观察分析。

 

awstats的安装

1 加压 拷贝 创建需要的文件

# tar xf awstats-7.6.tar.gz   解压下载到/root下的压缩包    

# mkdir /usr/local/awstats  

# mkdir /var/lib/awstats  

# chmod 755 /usr/local/awstats  

#cp -R awstats-6.5/ /usr/local/awstats     

# cd /usr/local/awstats/      进入到解压目录下    

# ls      

docs  README.TXT  tools  wwwroot    

# cd tools/    

# ls    

# perl awstats_configure.pl   

1 Config file path ('none' to skip web server setup):

> none      默认填写none就OK

 

2  Do you want me to build a new AWStats config/profile

file (required if first install) [y/N] ? y    默认yes就OK

 

3 Your web site, virtual server or profile name:

> www.a10.com                 上面介绍过通过www.a10.com来访问 并进行日志分析

 

4 Default: /etc/awstats           默认的配置文件存放位置

Directory path to store config file(s) (Enter for default):

>                                          敲enter键默认即可

    OK 交互界面结束

2  配置awstats的配置文件

# cd /etc/awstats  

# vim awstats.www.linuxidc.com.conf     

  //修改一下几项即可 其它都可以默认  

LogFile="/var/log/httpd/access_log" 

DirData="/var/lib/awstats" 

DirCgi="/awstats" 

DirIcons="/awstatsicons" 

//执行下面的命令 

# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.a10.com  

#开启地理位置支持(显示IP所在国家,城市统计)
LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/share/GeoIP/GeoIPCity.dat"
#yum install GeoIP GeoIP-data GeoIP-devel perl-Geo-IP -y #先安装软件包

 

 

 

 

4  配置web的配置文件

# vim /etc/httpd/conf/httpd.conf

  //在行尾添加如下内容

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"  

Alias /awstatscss "/usr/local/awstats/wwwroot/css/"  

Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"  

ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"  

#  

# This is to permit URL access to scripts/files in AWStats directory.  

#  

<Directory "/usr/local/awstats/wwwroot"> 

    Options None  

    AllowOverride None  

    # todo Allow open access:

    Require all granted  

</Directory> 

5 重启服务

#service httpd restart 

浏览器中输入http://www.a10.com/awstats/awstats.pl?config=www.a10.com 即可

看到如下图的日志分析页面

 




 


centOS 7 apache log 通过 AWStats 访问_ico


 

参考链接:

​稍有修改——http://www.linuxidc.com/Linux/2012-08/68004.htm​