Skip to content

Commit 797d3ae

Browse files
committed
docs(*): flesh out platform logging docs; add logspout docs
1 parent e44aa3d commit 797d3ae

4 files changed

Lines changed: 62 additions & 13 deletions

File tree

docs/managing_deis/controller_settings.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Requires: :ref:`cache <cache_settings>`, :ref:`database <database_settings>`, :r
1313

1414
Required by: :ref:`router <router_settings>`
1515

16-
Considerations: must live on the same host as logger (see `#985`_)
16+
Considerations: none
1717

1818
Settings set by controller
1919
--------------------------
@@ -73,4 +73,3 @@ Be sure that your custom image functions in the same way as the `stock controlle
7373
Deis. Specifically, ensure that it sets and reads appropriate etcd keys.
7474

7575
.. _`stock controller image`: https://github.com/deis/deis/tree/master/controller
76-
.. _`#985`: https://github.com/deis/deis/issues/985

docs/managing_deis/logger_settings.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Requires: none
1313

1414
Required by: :ref:`controller <controller_settings>`
1515

16-
Considerations: must live on the same host as controller (see `#985`_)
16+
Considerations: none
1717

1818
Settings set by logger
1919
------------------------
@@ -32,6 +32,12 @@ The logger component uses no keys from etcd.
3232

3333
Using a custom logger image
3434
---------------------------
35+
36+
.. note::
37+
38+
Instead of using a custom logger image, it is possible to redirect Deis logs to an external location.
39+
For more details, see :ref:`platform_logging`.
40+
3541
You can use a custom Docker image for the logger component instead of the image
3642
supplied with Deis:
3743

@@ -50,4 +56,3 @@ Be sure that your custom image functions in the same way as the `stock logger im
5056
Deis. Specifically, ensure that it sets and reads appropriate etcd keys.
5157

5258
.. _`stock logger image`: https://github.com/deis/deis/tree/master/logger
53-
.. _`#985`: https://github.com/deis/deis/issues/985

docs/managing_deis/platform_logging.rst

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,53 @@
44
.. _platform_logging:
55

66
Platform logging
7-
=========================
7+
================
88

9-
Comprehensive platform logging is a goal for Deis 1.0. We are currently investigating solutions for
10-
this, and progress can be tracked in GitHub issue `#980`_.
9+
Logging for Deis components and deployed applications is handled by two components:
10+
:ref:`logger` and :ref:`logspout`.
1111

12-
In the meantime, however, ``journalctl`` can be used to pipe log output to a remote host. For example,
13-
to send service log output to Papertrail:
12+
``deis-logspout`` is based on progrium's `logspout`_ project and runs on all CoreOS hosts. It
13+
collects logs from running containers and sends their logs to ``/deis/logs/host`` and
14+
``/deis/logs/port``.
15+
16+
``deis-logger`` collects the logs sent by logspout and archives them for use by :ref:`Controller`
17+
when a client runs ``deis logs``. This component publishes its host and port to ``/deis/logs/host``
18+
and ``/deis/logs/port``, and is typically the service which consumes logs from ``deis-logspout``.
19+
20+
Routing logs to a custom location
21+
---------------------------------
22+
23+
Logging to an external location can be achieved without modifying the log flow within Deis -
24+
we can simply send the master journal on a CoreOS host using ``ncat``. For example, if I'm using the
25+
`Papertrail`_ hosted log service, I can forward all logs on a host to Papertrail using the host
26+
and port provided to me by Papertrail:
27+
28+
.. code-block:: console
29+
30+
$ journalctl -o short -f | ncat --udp logs2.papertrailapp.com 23654
31+
32+
This is really only useful when shipped as a service that we don't have to run ourselves in
33+
a shell. We can use a fleet service for this:
1434

1535
.. code-block:: console
1636
17-
journalctl -o short -f | ncat --udp logs.papertrailapp.com 34000
37+
[Unit]
38+
Description=Log forwarder
39+
40+
[Service]
41+
ExecStart=/bin/sh -c "journalctl -o short -f | ncat --udp logs2.papertrailapp.com 23654"
42+
43+
[Install]
44+
WantedBy=multi-user.target
45+
46+
[X-Fleet]
47+
Global=true
48+
49+
Save the file as ``log-forwarder.service``. Load and start the service with
50+
``fleetctl load log-forwarder.service && fleetctl start log-forwarder.service``.
51+
52+
Shortly thereafter, you should start to see logs from every host in your cluster appear in the
53+
Papertrail dashboard.
1854

19-
.. _`#980`: https://github.com/deis/deis/issues/980
55+
.. _`logspout`: https://github.com/progrium/logspout
56+
.. _`papertrail`: https://papertrailapp.com/

docs/understanding_deis/architecture.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,19 @@ Registry
6464
The registry component hosts `Docker`_ images on behalf of the platform.
6565
Image data is stored by :ref:`Store`.
6666

67+
.. _logspout:
68+
69+
Logspout
70+
--------
71+
The logspout component is a customized version of `progrium's logspout`_ that runs
72+
on all CoreOS hosts in the cluster and collects logs from running containers. It sends the logs
73+
to the :ref:`logger` component.
74+
6775
.. _logger:
6876

6977
Log Server
7078
----------
71-
The log server component uses `rsyslog`_ to aggregate log data from
72-
across the platform.
79+
The log server component collects logs from the :ref:`logspout` component.
7380
This data can then be queried by the :ref:`Controller`.
7481

7582
.. _router:
@@ -96,5 +103,6 @@ which need to store state (namely :ref:`Registry` and :ref:`Database`).
96103
.. _`Nginx`: http://nginx.org/
97104
.. _`OpenStack Storage`: http://www.openstack.org/software/openstack-storage/
98105
.. _`PostgreSQL`: http://www.postgresql.org/
106+
.. _`progrium's logspout`: https://github.com/progrium/logspout
99107
.. _`Redis`: http://redis.io/
100108
.. _`rsyslog`: http://www.rsyslog.com/

0 commit comments

Comments
 (0)