In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Log scrolling log rotation is a common feature on Linux systems. It retains the necessary log content for system monitoring and troubleshooting, while preventing too many logs from causing a single log file to be too large.
The process of log scrolling is like this: in a set of log files, the largest (oldest) log file is deleted, and the remaining log file numbers increase in turn and replace the older log file. the newer file replaces it as the current log file. This process can be easily automated and fine-tuned as needed.
Log scrolling can be performed manually using the logrotate command. What this article will introduce is the method of manual log scrolling and the expected results.
The examples presented in this article apply to Linux systems such as Ubuntu, where log files and configuration files may be different for other types of systems, but the log scrolling process is more or less the same.
Why do you need to scroll the log?
In general, there is no need to manually rotate the log file. The Linux system automatically scrolls the log every other day (or at longer intervals) or depending on the size of the log file. If you need to scroll the log to free up storage space, or to separate a portion of the log from the current activity, this is easy to do, depending on the file scrolling rules.
A little background introduction
Many log files have been brought into the scope of log scrolling after the Linux system installation is complete. In addition, some applications set scrolling rules for the log files they generate when they install. In general, the configuration file for log scrolling is placed at / etc/logrotate.d. If you want to learn more about the detailed implementation of log scrolling, you can refer to this previous article.
As the log scrolls, the activity log is named with a new name, such as log.1, and files previously named log.1 are renamed log.2, and so on. In this set of files, the oldest log file (if named log.7) is deleted from the system. Parameters such as how files are named and the number of log files retained when the log is scrolled are determined by the configuration files in the / etc/logrotate.d directory, so you may see that some log files keep only a few scrolls, while some log files scroll to 7 or more times.
For example, syslog might look like this after scrolling through the log (note that the comment section at the end of the line only explains how the scrolling process affects the file name):
$ls-l / var/log/syslog*-rw-r- 1 syslog adm 128674 Mar 10 08:00 / var/log/syslog
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.