In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What is the role of the logs command in docker, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
View the output of the container
Problem: logs are not rotated or truncated, so written logs are persisted and continue to grow as long as the container still exists. Long-term persistence can be a problem for long-term processes. A better way is to use storage volumes to process log data.
Logs has a flag,-- follow or-f to display the entire log, and then will continue to monitor and update the display of the log without letting go of any changes in the log. Press ctrl+c to interrupt the logs command after completion
Docker logs-f zookeeper
Name default description
-details displays additional details provided to the log
-follow or-f output by log
-since starts to be displayed at a certain time, such as 2013-01-02T13:23:37
-tail all displays from how many lines at the end of the log
-timestamps or-t display timestamp
-until prints logs before a certain time, such as 2013-01-02T13:23:37
Docker container log cleanup
The logs of the docker container are generally stored under container_id under / var/lib/docker/containers/, ending with json.log.
(each container generates a corresponding container_id)
When the docker container is running, it is useless to delete log files by using rm, and disk space will still be occupied.
Because in Linux, using rm to delete a file is simply unlinking from the directory structure of the file system. If a process is using this file, the process will still be able to read the file and disk space will be occupied all the time.
Set the Docker container log size
This is achieved by configuring the max-size option of the container docker-compose
Global Settin
New / etc/docker/daemon.json, if there is no need to create a new one. Add log-dirver and log-opts parameters
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.