github.com/greenboxal/deis@v1.12.1/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  Application log drain
    20  ---------------------
    21  
    22  Application logs can be drained to an external syslog server (or compatible service such as Logstash, Papertrail, Splunk etc).
    23  
    24  .. code-block:: console
    25  
    26      $ deisctl config logs set drain=syslog://logs2.papertrailapp.com:23654
    27  
    28  This will send all application logs - there is currently no way to drain logs per application.
    29  
    30  Routing host logs to a custom location
    31  --------------------------------------
    32  
    33  Logging to an external location can be achieved without modifying the log flow within Deis -
    34  we can simply send the master journal on a CoreOS host using ``ncat``. For example, if I'm using the
    35  `Papertrail`_ hosted log service, I can forward all logs on a host to Papertrail using the host
    36  and port provided to me by Papertrail:
    37  
    38  .. code-block:: console
    39  
    40      $ journalctl -o short -f | ncat --ssl logs2.papertrailapp.com 23654
    41  
    42  This is really only useful when shipped as a service that we don't have to run ourselves in
    43  a shell. We can use a fleet service for this:
    44  
    45  .. code-block:: console
    46  
    47      [Unit]
    48      Description=Log forwarder
    49  
    50      [Service]
    51      ExecStart=/bin/sh -c "journalctl -o short -f | ncat --ssl logs2.papertrailapp.com 23654"
    52  
    53      [Install]
    54      WantedBy=multi-user.target
    55  
    56      [X-Fleet]
    57      Global=true
    58  
    59  Save the file as ``log-forwarder.service``. Load and start the service with
    60  ``fleetctl load log-forwarder.service && fleetctl start log-forwarder.service``.
    61  
    62  Shortly thereafter, you should start to see logs from every host in your cluster appear in the
    63  Papertrail dashboard.
    64  
    65  .. _`logspout`: https://github.com/progrium/logspout
    66  .. _`papertrail`: https://papertrailapp.com/