How to realize nginx log file segmentation in Linux
In this issue, the editor will bring you about how to achieve nginx log file segmentation in Linux. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
Step 1:
Vi / etc/logrotate.d/nginx
The script content is as follows
/ usr/local/nginx/logs/access.log {dailyrotate 7missingoknotifemptydateextsharedscriptspostrotate if [- f / usr/local/nginx/logs/nginx.pid]; then kill-USR1 `cat / usr/local/nginx/logs/ nginx.pid`fiendscript}
Step 2: test for availability
/ usr/sbin/logrotate-f / etc/logrotate.d/nginx
Step 3: configure scheduled tasks (vi / etc/crontab)
0 * / usr/sbin/logrotate-f / etc/logrotate.d/nginx above is how to split nginx log files in the Linux shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.