In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
As we all know, there is a file in the log generated by Nginx. With the longer the running time of the website, the size of the log file is also growing, so it is necessary to achieve timing segmentation at this time. This article mainly introduces the relevant information about nginx to achieve regular division of logs every day under CentOS 7.0. friends who need it can refer to it.
Environment description:
Operating system CentOS7.0, nginx is installed online by default.
Nginx profile path: / etc/nginx/nignx.conf
Nginx log file path: / var/log/nginx/access.log
Nignx.pid path: / run/nginx.pid
New timing script location / shell/nginx/logs.sh
1. Create a new script and execute
# mkdir / shell/nignx#cd / shell/nginx#vim logs.sh http://www.iis7.com/b/ssyqdq/
#! / bin/bashbase_path='/var/log/nginx'log_path= (date − d yesterday + "(date-d yesterday +"% Y% m ") day= (date − d yesterday +" (date-d yesterday + "% Y%m%d") mkdir-p base path/ base_path/ base path/ log_pathmv$base_path/access.log Base path/ base_path/ base path/ log_path/access_$day.log#echo base path/ base_path/ base path/ log_path/access_$day.logkill-USR1 cat / run/nginx.pid
# chmod a+X#./logs.sh
two。 Regular execution (0: 00 every day)
# crontab-eBay 0 0 * / bin/bash / shell/nginx/logs.sh#wq
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.