docker logspout
https://hub.docker.com/r/jplock/rsyslog/
docker pull jplock/rsyslog:8.2.2
docker run -d -p 514:514 jplock/rsyslog:8.2.2
https://github.com/gliderlabs/logspout
Using logspout (cannot start without route)
Route all container output to remote syslog
The simplest way to use logspout is to just take all logs and ship to a remote syslog. Just pass a syslog URI (or several comma separated URIs) as the command. Also, we always mount the Docker Unix socket with -v
to/var/run/docker.sock
:
$ docker run --name="logspout" \
--volume=/var/run/docker.sock:/var/run/docker.sock \
gliderlabs/logspout \
syslog://logs.papertrailapp.com:55555
logspout will gather logs from other containers that are started without the -t
option.
To see what data is used for syslog messages, see the syslog adapter docs.
Ignoring specific containers
You can tell logspout to ignore specific containers by setting an environment variable when starting your container, like so:-
$ docker run -d -e 'LOGSPOUT=ignore' image
Inspect log streams using curl
Using the httpstream module, you can connect with curl to see your local aggregated logs in realtime. You can do this without setting up a route URI.
$ docker run -d --name="logspout" \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--publish=127.0.0.1:8000:80 \
gliderlabs/logspout
$ curl http://127.0.0.1:8000/logs
You should see a nicely colored stream of all your container logs. You can filter by container name and more. You can also get JSON objects, or you can upgrade to WebSocket and get JSON logs in your browser.
See httpstream module for all options.
Create custom routes via HTTP
Using the routesapi module logspout can also expose a /routes
resource to create and manage routes.
$ curl $(docker port `docker ps -lq` 8000)/routes \
-X POST \
-d '{"source": {"filter": "db", "types": ["stderr"]}, "target": {"type": "syslog", "addr": "logs.papertrailapp.com:55555"}}'
That example creates a new syslog route to Papertrail of only stderr
for containers with db
in their name.
Routes are stored on disk, so by default routes are ephemeral. You can mount a volume to /mnt/routes
to persist them.
See routesapi module for all options.
docker logspout的更多相关文章
- Docker入门 - 006 Docker 多种数据库的安装
Docker 安装 MySQL 查找Docker Hub上的mysql镜像 root@VM_16_14_centos ~# docker search mysql INDEX NAME DESCRIP ...
- Docker安装和使用(转)
(转)原文地址:https://www.cnblogs.com/xiewenming/p/7903247.html 一,安装Docker 1.1 安装之前保持一个干净的Docker环境 sudo yu ...
- GrayLog + Logspout + Docker 实现分布式日志聚合
前提条件:你的服务器上已经安装了Docker和Docker Compose 一.安装GrayLog(Docker方式) version: '2' services: mongodb: image: m ...
- Docker日志自动化: ElasticSearch、Logstash、Kibana以及Logspout
http://www.open-open.com/lib/view/open1432107136989.html
- 关于docker
摘要: 最近很多阿里内部的同学和客户私信来咨询如何学习 Docker 技术.为此,我们列了一个路线图供大家学习Docker和阿里云容器服务.这个列表包含了一些社区的优秀资料和我们的原创文章.我们会随着 ...
- Building good docker images
The docker registry is bursting at the seams. At the time of this writing, a search for "node&q ...
- Docker有什么好处?
Docker背后的想法是创建软件程序可移植的轻量容器,让其可以在任何安装了Docker的机器上运行,而不用关心底层操作系统,类似船舶使用的集装箱,野心勃勃的他们成功了. Docker可以解决虚拟机能够 ...
- Docker第三方项目小结
软件项目的成功常常根据其催生的生态系统来衡量.围绕或基于核心技术构建的项目增添了功能和易用性,它们常常日臻完善.Docker就是一个典例,有众多第三方项目扩展.补充或改进Docker. •Docker ...
- Logspout安装、使用
Docker还没有提供一种方法来管理在Docker容器里面运行的程序所生成的日志.Logspout是一个Docker容器,大小仅14MB,使用BusyBox作为其核心,它可以将来自容器应用程序的日志发 ...
随机推荐
- swift算法手记-10
http://blog.csdn.net/myhaspl private func findnode(val:Int)->Bool{//http://blog.csdn.net/myhaspl ...
- Maven入门学习
1 Maven的安装 maven下载路径:http://maven.apache.org/download.cgi 我是在win7上安装了,安装后在cmd输入 mvn -v: C:\Users\*** ...
- C语言 | 计算器实现 version 2.
在之前版本中使用栈结构来实现,但由于51单片机不支持malloc函数,所以使用C语言又写了一个计算器版本. 通过数组存放值和操作符模拟栈操作. 实现代码: #include <stdio.h&g ...
- jQuery 文档操作 - insertAfter() ,insertBefore(),after(),before() 方法
这个方法跟prependTo()和appendTo()不一样的地方在于,一个是仍然插入到元素内部,而insertAfter和insertBefore是插入到元素外部. 这里拿insertBefore来 ...
- python 列表,元组,字符串方法和属性
python序列包含列表[].元组().字符串三种 -------列表-------------- 一.列表基本内容 1.建立:a=[1,2,3,5],通过[ , ,], >>>b= ...
- 正则化--L1正则化(稀疏性正则化)
稀疏矢量通常包含许多维度.创建特征组合会导致包含更多维度.由于使用此类高维度特征矢量,因此模型可能会非常庞大,并且需要大量的 RAM. 在高维度稀疏矢量中,最好尽可能使权重正好降至 0.正好为 0 的 ...
- webAPP开发的问题(总结)
自Iphone和Android这两个牛逼的手机操作系统公布以来,在互联网界从此就多了一个新的名词-WebApp(意为基于WEB形式的应用程序.执行在高端的移动终端设备). 开发人员们都知道在高端智能手 ...
- 利用Python读取文件名并生成txt文件——以图片文件为例
效果如下: 代码: import os class ReadImageName(): def __init__(self): self.path = '.' def readname(self): f ...
- c++ why doesn't c++ allow rebinding a reference ?
http://stackoverflow.com/questions/27037744/why-doesnt-c-allow-rebinding-a-reference# 1. The primary ...
- C# 子类实例化过程
刚研究了一下C#子类实例化的过程. 首先我遇到了如下一个问题: 有类A,里面写了一个有参的构造函数,并没有提供默认的无参构造函数.现在类B继承了类A,没有写任何的构造函数. 这时如果想实例化类B就会产 ...