Skip to content

Commit

Permalink
Provide complete standalone compose file for loki
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJKoopman committed Aug 13, 2020
1 parent 4ca73f0 commit bbff60b
Showing 1 changed file with 34 additions and 20 deletions.
54 changes: 34 additions & 20 deletions docs/user/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,52 @@ You should then see the plugin installed::
Now that we have the plugin installed we need to start the Loki service. This
can be done several ways, however we recommend using Docker or Docker Compose.
For more installation methods, see the `Loki installation documentation`_. To
use Docker Compose, add a Loki service to your Docker Compose file::

loki:
image: grafana/loki:1.5.0
<<: *log-options
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml

.. note::
Version 1.5.0 was the latest at the time of this writing, but there may be
more recent versions available. You can check on the grafana/loki Docker
Hub page.

You will notice the ``log-options`` YAML alias. This refers back to a
log-options anchor, which you should also add to you Compose file::

use Docker Compose a separate docker-compose.yml file allows you to keep the
service running all the time even if you bring down your OCS containers. An
example Compose file looks like::

version: '3.7'
volumes:
loki-storage:
x-log-options:
&log-options
logging:
driver: loki
options:
loki-url: "http://localhost:3100/loki/api/v1/push"
services:
loki:
image: grafana/loki:1.5.0
<<: *log-options
container_name: "loki"
restart: always
ports:
- "3100:3100"
volumes:
- loki-storage:/loki
command: -config.file=/etc/loki/local-config.yaml
networks:
default:
external:
name: ocs-net

.. note::
Version 1.5.0 was the latest at the time of this writing, but there may be
more recent versions available. You can check on the grafana/loki Docker
Hub page.

You will notice the ``log-options`` YAML alias. This refers back to the
log-options anchor. You will need to add the ``log-options`` alias to any
service which you would like to forward their logs to Loki.

.. note::
The ``loki-url`` here must match the address of the node you are running
the grafana/loki container on. In this case that is ``localhost``, but if you
have a multi-node configuration this could be a different IP address.

You should then add the ``log-options`` alias to any service which you would
like to forward their logs to Loki.

The plugin can also be enabled for all containers on the system by configuring
the logging driver in the Docker daemon configuration. For more details see the
`Loki Docker driver documentation`_.
Expand Down

0 comments on commit bbff60b

Please sign in to comment.