github.com/tmlbl/deis@v1.0.2/docs/managing_deis/platform_logging.rst (about)

     1  :title: Platform logging
     2  :description: Configuring platform logging.
     3  
     4  .. _platform_logging:
     5  
     6  Platform logging
     7  ================
     8  
     9  Logging for Deis components and deployed applications is handled by two components:
    10  :ref:`logger` and :ref:`logspout`.
    11  
    12  ``deis-logspout`` runs on all CoreOS hosts, collects logs from running containers
    13  and sends their logs to ``/deis/logs/host`` and ``/deis/logs/port``.
    14  
    15  ``deis-logger`` collects the logs sent by logspout and archives them for use by :ref:`Controller`
    16  when a client runs ``deis logs``. This component publishes its host and port to ``/deis/logs/host``
    17  and ``/deis/logs/port``, and is typically the service which consumes logs from ``deis-logspout``.
    18  
    19  Routing logs to a custom location
    20  ---------------------------------
    21  
    22  Logging to an external location can be achieved without modifying the log flow within Deis -
    23  we can simply send the master journal on a CoreOS host using ``ncat``. For example, if I'm using the
    24  `Papertrail`_ hosted log service, I can forward all logs on a host to Papertrail using the host
    25  and port provided to me by Papertrail:
    26  
    27  .. code-block:: console
    28  
    29      $ journalctl -o short -f | ncat --udp logs2.papertrailapp.com 23654
    30  
    31  This is really only useful when shipped as a service that we don't have to run ourselves in
    32  a shell. We can use a fleet service for this:
    33  
    34  .. code-block:: console
    35  
    36      [Unit]
    37      Description=Log forwarder
    38  
    39      [Service]
    40      ExecStart=/bin/sh -c "journalctl -o short -f | ncat --udp logs2.papertrailapp.com 23654"
    41  
    42      [Install]
    43      WantedBy=multi-user.target
    44  
    45      [X-Fleet]
    46      Global=true
    47  
    48  Save the file as ``log-forwarder.service``. Load and start the service with
    49  ``fleetctl load log-forwarder.service && fleetctl start log-forwarder.service``.
    50  
    51  Shortly thereafter, you should start to see logs from every host in your cluster appear in the
    52  Papertrail dashboard.
    53  
    54  .. _`logspout`: https://github.com/progrium/logspout
    55  .. _`papertrail`: https://papertrailapp.com/