In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use the logs command in docker to display the last few lines". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to display the last few lines with the logs command in docker.
In docker, you can use the "--tail" parameter of the logs command to display the last lines of logs, the logs command to get the container logs, and the "--tail" parameter to set to list only the latest container logs with the syntax of "docker logs-- tail= rows".
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
How does the logs command display the last few lines in docker
Docker logs: get the log of the container
Grammar
Docker logs [OPTIONS] CONTAINER
OPTIONS description:
-f: trace log output
-- since: displays all logs at a certain start time
-t: displays the timestamp
-- tail: only the latest N container logs are listed
Example
Trace and view the log output of the container mynginx.
Runoob@runoob:~$ docker logs-f mynginx192.168.239.1-- [10/Jul/2016:16:53:33 + 0000] "GET / HTTP/1.1" 200612 "-" Mozilla/5.0 (Windows NT WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36 ""-"16:53:33 on 2016-07-10 [error] 5: * 1 open ()" / usr/share/nginx/html/favicon.ico "failed (2: No such file or directory), client: 192.168.239.1, server: localhost, request:" GET / favicon.ico HTTP/1.1 ", host:" 192.168.239.130 " Referrer: "http://192.168.239.130/"192.168.239.1-- [10/Jul/2016:16:53:33 + 0000]" GET / favicon.ico HTTP/1.1 "404 571" http://192.168.239.130/"Mozilla/5.0 (Windows NT WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36 "-" 192.168.239.1-- [10/Jul/2016:16:53:59 + 0000] "GET / HTTP/1.1" 3040 "-"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36"-".
Check the latest 10 logs of container mynginx since July 1, 2016.
Docker logs-- since= "2016-07-01"-- tail=10 mynginx here, I believe you have a better understanding of "how to use the logs command in docker to display the last few lines". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.