In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Log segmentation * * as the number of visits to the website increases By default, the Apache single log file will also become larger and larger * the log file takes up a lot of disk space * it is not convenient to view relevant information * * the log file is split * * Apache comes with the rotatelogs split tool * third-party tool cronolog split rotatelogs split tool configuration website log files are transferred to rotatelogs split processing configuration format > ErrorLog "| absolute path of rotatelogs command Path-l log file path / website name-error_%Y%m%d.log 86400 "> CustomlogLog" | rotatelogs command path-l log file path / site name-error_%Y%m%d.log 86400 "Linux server in combined environment (192.168.13.128) A win7 test host Apache comes with rotatelogs log segmentation tool 1 Install Apache service [root@localhost ~] # yum install httpd-y [root@localhost ~] # cd / usr/sbin # # switch to [root@localhost sbin] # ls rotat* # # Log analysis tool location rotatelogs [root@localhost sbin] # vim / etc/httpd/conf/httpd.conf # # modify configuration file Listen 192.168.13.128 vim 80 # # modify ipv4 listener Port # Listen 80 # # annotate the ipv6 port ServerName www.kgc.com:80 # # modify the domain name [root@localhost named] # systemctl stop firewalld.service # # turn off the firewall [root@localhost named] # setenforce 0 # # turn off the enhanced function [root@localhost html] # systemctl start httpd.service # # start the network service [root@localhost sbin] # ls / var/log/httpd/ # # then you will have the log file accesslog errorlog2 Configure http master profile information
[root@localhost sbin] # cd / etc/httpd/conf
[root@localhost conf] # vim httpd.conf # # configure http main configuration file
# ErrorLog "logs/errorlog"
ErrorLog "| / usr/sbin/rotatelogs-l logs/www.kgc.com.error%Y%m%dlog 86400"
# # add the absolute path of the tool here and the time when the log is generated
CustomLog "| / usr/sbin/rotatelogs-l logs/www.kgc.com.access_%Y%m%dlog 86400" combined
# # add the absolute path of the tool here and the time when the log is generated
3. Shut down and restart the service View log partition [root@localhost conf] # systemctl stop httpd.service # # disable http service [root@localhost conf] # systemctl start httpd # # start http service [root@localhost conf] # cd / var/log/httpd/ # # switch to log directory to view [root@localhost httpd] # lsaccess_log error_log www.kgc.com.error_20191025log # # is today's score Cut log file [root@localhost httpd] # date2019 Friday, October 25th, 09:12:31 CST [root@localhost httpd] # date-s 10-26-19 # # modification time is tomorrow, October 26th, 2019, at 00:00:00 CST [root@localhost httpd] # systemctl stop httpd # # shut down and restart the service [root@localhost httpd] # systemctl start httpd [root@localhost httpd] # ls # # View date Access_log www.kgc.com.error_20191025logerror_log www.kgc.com.error_20191026log third-party tool cronolog tool source code compilation installation cronolog tool configuration website log file is transferred to cronolog split processing configuration format is > ErrorLog "| absolute path log file path / website name of cronolog command-error_%Y%m%d.log" > CustomlogLog "| absolute path log file of cronolog command Path / site name-error_%Y%m%d.log "combined1 Install the http service Remotely mount third party tools [root@localhost ~] # yum install httpd-y [root@localhost ~] # smbclient-L / / 192.168.10.88 / Sharename Type Comment-LAMP-C7 Disk [root@localhost ~] # mount. Cifs / / 192.168.10.88/LAMP-C7 / mnt # # remotely mount the software package to the / mnt directory [root@localhost ~] # cd / mnt/ # # switch to the / mnt directory [root@localhost mnt] # lsapr-1.6.2.tar.gz cronolog-1.6.2-14.el7.x86_64.rpm LAMP-php5.6.txtapr-util-1.6.0.tar.gz Discuz_X2.5_SC_UTF8 .zip mysql-5.6.26.tar.gzawstats-7.6.tar.gz httpd-2.4.29.tar.bz2 php-5.6.11.tar.bz2 [root@localhost mnt] # rpm-ivh cronolog-1.6.2-14.el7.x86_64.rpm # # installation tool 2 View the tool and modify the http configuration file [root@localhost mnt] # cd / usr/sbin [root@localhost sbin] # ls cronolog*cronolog [root@localhost sbin] # vim / etc/httpd/conf/httpd.conf Listen 192.168.13.128 cd 80 # modify the listening address # Listen 80ServerName www.kgc.com:80 # # modify the domain name 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## modifies log file 3 Restart the http service and view the log file [root@localhost sbin] # systemctl restart httpd # # restart the http service [root@localhost sbin] # ls / var/log/httpd # # View the log file www.kgc.com.error_20191025.log above is the log segmentation of Apache!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.