In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.