Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A case of rotation of nginx logs in linux operation and maintenance

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the case of rotation of nginx logs in linux operation and maintenance. I hope you will gain a lot after reading this article. Let's discuss it together.

There is a very useful alternate service on the linux system-logrotate. Through this service, log files can be managed alternately. When the log file is too large, it can be cut into several small log files, and it can be compressed. Nginx default log files access.log and error.log log files are not rotated on their own. Therefore, logrotate is often used to alternate management of nginx logs.

Logrotate

For logrotate, the operation of this program is executed daily in the scheduled tasks of the system.

# cat / etc/cron.daily/logrotate #! / bin/sh/usr/sbin/logrotate-s / var/lib/logrotate/logrotate.status.

Next, let's take a look at the configuration file / etc/logrotate.conf for logrotate.

# see more information via man logrotate # here is the default configuration weekly

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report