Article Directory
- 1. Overview
- 2. Experimental steps
-
- Experiment 1. Use of rotatelogs segmentation tool
- Experiment 2. Visit AWStats analysis system
-
- 1. Turn off the firewall
- 2. Install apache service
- 3. Modify the main configuration file
- 4. Modify the regional configuration file
- 5. Modify the area details file
- 6. Start the DNS service
- 7, edit the http configuration file
- 8. Restart the http service
- 9. Create interface files
- 10. The test domain name is successfully configured
- 11. Unzip the awstats toolkit
- 12. Installation
- 13, edit the configuration file
- 14. Edit the log split configuration file
- 15, create a directory
- 16, restart the service
- 17. Access interface view
- 18. Update data
- 19. Set planned tasks to update data
- 20. Create optimized web pages
- 21. Direct address access
1. Overview
1. Log split
1. With the increase of website visits, Apache’s single daily file will also become larger and larger by default
- Log files take up a lot of disk space
- Inconvenient to view related information
2. Split the log file
- Apache comes with rotatelogs segmentation tool implementation
- Third-party tool cronolog segmentation
2. Introduction to AWStats log analysis system
- An open source log analysis system developed by Perl language
- It can be used to analyze the access logs of Apache, Samba, Vsftpd, IIS and other servers
- Combined with crond and other scheduled task services, the log content can be analyzed regularly
3. The configuration difference between rotatelogs tool and cronolog tool
1. Rotatelogs tool
ErrorLog “| /usr/sbin/rotatelogs -l logs/www.kgc.com.error_%Y%m%d.log 86400”
CustomLog “| /usr/sbin/rotatelogs -l logs/www.kgc.com.access_%Y%m%d.log 86400” combined
2. Cronolog tool
ErrorLog “| /usr/sbin/cronolog logs/www.kgc.com.error_%Y%m%d.log”
CustomLog “| /usr/sbin/cronolog logs/www.kgc.com.access_%Y%m%d.log” combined
2. Experimental steps
Experiment 1. Use of rotatelogs segmentation tool
1. Turn off the firewall
iptables -F
setenforce 0
2. Install Apache service
yum install httpd -y
3. Modify the configuration file
vim /etc/httpd/conf/httpd.conf
4. Test and restart the http service
httpd -t
systemctl restart httpd
5. View the local log file
ls /var/log/httpd/
6. Modify the system time
date -s 09/05/20 ## Modification time is September 05, 2020
ls /var/log/httpd/ ##View the list of log files in the directory
systemctl restart httpd ##Restart the service
ls /var/log/httpd/ ##View the list of new log files generated after restart
Experiment 2. Visit AWStats analysis system
1. Turn off the firewall
iptables -F
setenforce 0
2. Install apache service
yum install bind httpd -y
3. Modify the main configuration file
vim /etc/named.conf
4. Modify the regional configuration file
vim /etc/named.rfc1912.zones
5. Modify the area details file
cd / var / named /
cp -p named.localhost kgc.com.zone
vim kgc.com.zone
6. Start the DNS service
systemctl start named
7, edit the http configuration file
vim /etc/httpd/conf/httpd.conf
8. Restart the http service
systemctl restart httpd
9. Create interface files
cd / var / www / html /
vim index.html
10. The test domain name is successfully configured
The DNS server of the win10 host is: 192.168.235.135
Visit address: www.kgc.com
11. Unzip the awstats toolkit
Upload the file awstats-7.6.tar.gz to the server directory /opt
cd / opt
tar zxvf awstats-7.6.tar.gz ##Unzip
mv awstats-7.6 /usr/local/awstats ##File translation
cd /usr/local/awstats/ ##Directory jump
ls
cd tools /
ls
12. Installation
./awstats_configure.pl
/etc/httpd/conf/httpd.conf
and
www.kgc.com
Carriage return
Carriage return
13, edit the configuration file
vim /etc/httpd/conf/httpd.conf
14. Edit the log split configuration file
vim /etc/awstats/awstats.www.kgc.com.conf
15, create a directory
cd / var / lib
ls
mkdir awstats
16, restart the service
systemctl restart httpd
17. Access interface view
http://www.kgc.com/awstats/awstats.pl?config=www.kgc.com
18. Update data
Address: www.kgc.com Refresh several times
http://www.kgc.com/awstats/awstats.pl?config=www.kgc.com ##No interface update
cd /usr/local/awstats/tools/
./awstats_updateall.pl now ##Update data
19. Set planned tasks to update data
crontab -e
20. Create optimized web pages
cd / var / www / html
vim aws.html
21. Direct address access
http://www.kgc.com/aws.html