查看Docker容器日志信息 | IT运维网
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!
  • 本站为个人技术性博客网站,上面会更新一些系统、网络、云计算和监控等相关运维的技术性文章,供大家参考、学习和一起交流。

查看Docker容器日志信息

Docker yvan 1年前 (2018-08-26) 740次浏览 已收录 0个评论 扫描二维码

格式:docker container logs [OPTIONS] CONTAINER
    -t:日志显示加上时间戳
    -f:为日志追踪模式等同于tailf效果

-t:日志显示加上时间戳;默认是不显示时间戳的

[root@localhost data]# docker container logs -t nginx
2019-01-31T03:17:44.319071309Z 192.168.80.1 - - [31/Jan/2019:03:17:44 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:17:44.798148003Z 192.168.80.1 - - [31/Jan/2019:03:17:44 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:17:45.088876036Z 192.168.80.1 - - [31/Jan/2019:03:17:45 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:17:45.266688588Z 192.168.80.1 - - [31/Jan/2019:03:17:45 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:17:45.449043348Z 192.168.80.1 - - [31/Jan/2019:03:17:45 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:33.915925608Z 192.168.80.1 - - [31/Jan/2019:03:21:33 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:34.491670969Z 192.168.80.1 - - [31/Jan/2019:03:21:34 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:34.843591995Z 192.168.80.1 - - [31/Jan/2019:03:21:34 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:35.020473695Z 192.168.80.1 - - [31/Jan/2019:03:21:35 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:35.207778164Z 192.168.80.1 - - [31/Jan/2019:03:21:35 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:35.389010463Z 192.168.80.1 - - [31/Jan/2019:03:21:35 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:35.562754644Z 192.168.80.1 - - [31/Jan/2019:03:21:35 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:35.734901477Z 192.168.80.1 - - [31/Jan/2019:03:21:35 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:35.916871057Z 192.168.80.1 - - [31/Jan/2019:03:21:35 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T03:21:36.107997109Z 192.168.80.1 - - [31/Jan/2019:03:21:36 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"

-f:为日志追踪模式等同于tailf效果

[root@localhost data]# docker container logs -t -f nginx
2019-01-31T08:01:31.049662031Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.105231206Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.220514585Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.263025537Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.362787106Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.374828581Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.428257123Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.504792643Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.537910486Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.590458347Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"
2019-01-31T08:01:31.681958283Z 192.168.80.1 - - [31/Jan/2019:08:01:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "-"


IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明查看Docker容器日志信息
喜欢 (1)
[yvan.lu@ityww.cn]
分享 (0)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!