In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you about the way MongoDB logs are cut. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Preface
Services running online will generate a large number of operation and access logs, which will contain some information such as errors, warnings and user behavior. Usually, the service records the log information in the form of text, which is highly readable and convenient for daily positioning problems. However, when a large number of logs are generated, in order to mine valuable content from a large number of logs, it is necessary to further store and analyze the data.
Any kind of database has a variety of logs, and MongoDB is no exception. There are four kinds of logs in MongoDB, which are system log, Journal log, oplog master-slave log, slow query log and so on. These logs record different aspects of the MongoDB database.
MongoDB does not cut logs by default. Unless we configure logRotate = rename and restart the MongoDB service, we will cut logs. In order to avoid that one of our log files is too large, we need to cut logs in two ways:
The methods are as follows. Cut through MongoDB management commands
When using this command, you need to specify the log file path while MongoDB is running. -- logpath [file], or specified in the configuration file.
Use admindb.runCommand ({logRotate:1}) 2. Cut through the service logrotate that comes with the Linux system
First we need to configure the MongoDB parameters logRotate = reopen, logappend = true, and then through the logrotate that comes with the Linux system. Example of a profile placed in / etc/logrotate.d/, cutting profile:
/ opt/mongodb/log/mongodb.log {rotate 180 dailysize 100Molddir / opt/mongodb/log/oldlogcopytruncatedateextcompressnotifemptymissingok} 3. Cut the log by sending a SIGUSR1 signal to the process
If our process id is 19555, then we can cut the log with the following command. As soon as we execute the command, the log will be cut immediately.
Kill-SIGUSR1 19555 Thank you for your reading! This is the end of this article on "what are the ways of cutting MongoDB logs?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.