Web Log deployment and management

Source: Internet
Author: User
Tags apache log

I, Web Log deployment1. apache log files are single and can easily reach the limit of 2 GB. It is easy to fill up/var volumes, and it is necessary to automatically split them, then you can use the automatic processing program for compression and other operations. To process Apache log files, you must stop Apache. Otherwise, some logs will be lost. The comrades who have performed these operations are certain that they will surely be able to understand the difficult points. Find a program named cronolog that specifically processes Apache logs on the Internet, and set the log pipeline in Apache to the program for necessary processing. In the setting file, modify: customlog "|/usr/sbin/cronolog/logs/% Y/% m/anheng _ % Y % m % d. log "W3C will automatically open the directory on a monthly basis. One log file is generated every day. Customlog "|/usr/local/sbin/cronolog/var/log/Baidu/baidu_access_log. % Y % m % d "combinedcustomlog" |/usr/local/sbin/cronolog/var/log/fucai/fucai_access_log. % Y % m % d "combined the cronolog software must be installed first. By default, the cronolog software can be installed. After installation, add the above entries to the Apache configuration file. If the virtual machine is to be added to the virtual machine. 2. The generated logs are generated every day in a round of ten days, one day, named after the day, using ftp in the/home/Xiaolong directory. the sh script is regularly uploaded to the Log Analysis Server (webtreds) on a daily basis. You can use/etc/crontab for regular upload. The specific script is as follows: ftp. sh host = 192.168.0.9rq = 'date -- date = "1 days ago" + % Y % m % d' filename = baidu_access_log. $ RQ # baidu_access_log. % Y % m % dusername = Baidu # ftp user namepasswd = huifeidezhu # ftp user passwordcd/var/log/baiduftp-I-n <! Open $ hostuser $ username $ passwdpromptcm web1 // (the web of 192.168.5.32 is uploaded to web1) Put $ filenamebye! 2. Log File Management the Web server has a small space and must be cleared in time. You can write scripts to regularly Delete uploaded scripts. Find/var/log/Baidu-type F-mtime + 7-exec RM {}/; this command deletes all web log files seven days ago and can be added to crontab for regular execution.

All logs must be retained, but the storage space of the log server is limited. Therefore, backup is required every other time, for example, two months. After the backup is deleted, the backup must be compressed first, (WinRAR can be compressed to one of the original 20 points). A package of one month is named "year-on-year server. log "such as 200606a. log is the log package of the first web server in June 2006. Packaging logs must be engraved

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.