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的更多相关文章

  1. Docker入门 - 006 Docker 多种数据库的安装

    Docker 安装 MySQL 查找Docker Hub上的mysql镜像 root@VM_16_14_centos ~# docker search mysql INDEX NAME DESCRIP ...

  2. Docker安装和使用(转)

    (转)原文地址:https://www.cnblogs.com/xiewenming/p/7903247.html 一,安装Docker 1.1 安装之前保持一个干净的Docker环境 sudo yu ...

  3. GrayLog + Logspout + Docker 实现分布式日志聚合

    前提条件:你的服务器上已经安装了Docker和Docker Compose 一.安装GrayLog(Docker方式) version: '2' services: mongodb: image: m ...

  4. Docker日志自动化: ElasticSearch、Logstash、Kibana以及Logspout

    http://www.open-open.com/lib/view/open1432107136989.html

  5. 关于docker

    摘要: 最近很多阿里内部的同学和客户私信来咨询如何学习 Docker 技术.为此,我们列了一个路线图供大家学习Docker和阿里云容器服务.这个列表包含了一些社区的优秀资料和我们的原创文章.我们会随着 ...

  6. Building good docker images

    The docker registry is bursting at the seams. At the time of this writing, a search for "node&q ...

  7. Docker有什么好处?

    Docker背后的想法是创建软件程序可移植的轻量容器,让其可以在任何安装了Docker的机器上运行,而不用关心底层操作系统,类似船舶使用的集装箱,野心勃勃的他们成功了. Docker可以解决虚拟机能够 ...

  8. Docker第三方项目小结

    软件项目的成功常常根据其催生的生态系统来衡量.围绕或基于核心技术构建的项目增添了功能和易用性,它们常常日臻完善.Docker就是一个典例,有众多第三方项目扩展.补充或改进Docker. •Docker ...

  9. Logspout安装、使用

    Docker还没有提供一种方法来管理在Docker容器里面运行的程序所生成的日志.Logspout是一个Docker容器,大小仅14MB,使用BusyBox作为其核心,它可以将来自容器应用程序的日志发 ...

随机推荐

  1. C++五种迭代器之间的关系

    迭代器操作                      说明(1)所有迭代器p++                              后置自增迭代器++p                     ...

  2. 【Android进阶】怎样使用文件来保存程序中的数据

    在程序中.有非常多保存和获取数据的方法,本篇文章,主要介绍使用文件系统对程序中的数据进行保存和读取的操作 我直接写了一个帮助类,进行文件的写入和读取操作 /** * 用于在文件里保存程序数据 * * ...

  3. EntityFramework.SqlServer.dll 中发生 其他信息: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - 无法打开到 SQL Server 的连接)

    解决方案: 1.打开Sql server 管理配置器 或者在命令行输入:SQLServerManager10.msc 2.点击MSSQLSERVER的协议,在右侧的页面中选择TCP/IP协议启用 3. ...

  4. Service#onStartCommand返回值解析

    Service#onStartCommand返回值解析 Service类有个生命周期方法叫onStartCommand,每次启动服务(startService)都会回调此方法.此方法的原型例如以下: ...

  5. C#中基本类型占用字节数

    bool -> System.Boolean (布尔型,其值为 true 或者 false) byte -> System.Byte (字节型,占 1 字节,表示 8 位正整数,范围 0 ...

  6. oracle命令登录数据库

    sqlplus aa/aa@jdbc:oracle:thin:@10.200.130.111:1521:nbact 或者 sqlplus aa/aa@nbact

  7. SVN各种错误提示产生原因及处理方法大全(转)

    SVN各种错误提示产生原因及处理方法大全 1. svn: Server sent unexpected return value (500 Internal Server Error) in resp ...

  8. 活动招募 HUAWEI HiAI公开课·北京站-如何在4小时把你的APP变身AI应用

    人工智能和机器学习是全球关注的新趋势,也是当前最火爆.最流行的话题.当你拿手机用语音助手帮你点外卖,智能推荐帮你把周边美食一网打尽:当你拿起P20拍照时,它将自动识别场景进行最美优化,让你成为摄影大师 ...

  9. C# WEB 不显示目录结构

    <system.webServer> <directoryBrowse enabled="false" /> </system.webServer&g ...

  10. js实现点击定位最顶端

    //------------------------------------点击按钮------------------------------------ <span onClick=&quo ...