Loki

  • Canonical Observability
Channel Revision Published Runs on
latest/stable 160 10 Sep 2024
Ubuntu 20.04
latest/candidate 161 19 Nov 2024
Ubuntu 20.04
latest/beta 177 19 Nov 2024
Ubuntu 20.04
latest/edge 177 16 Nov 2024
Ubuntu 20.04
1.0/stable 104 12 Dec 2023
Ubuntu 20.04
1.0/candidate 104 22 Nov 2023
Ubuntu 20.04
1.0/beta 104 22 Nov 2023
Ubuntu 20.04
1.0/edge 104 22 Nov 2023
Ubuntu 20.04
juju deploy loki-k8s --channel beta
Show information

Platform:

Relations

Overview

Relations provide a means to integrate applications and enable a simple communications channel. Loki Charmed Operator supports the following:

Provides

Logging

Loki Charmed Operator may receive logs from any charm that supports the loki_push_api relation interface.

For instance let’s say that we have a Promtail Charmed Operator that implements the other side (requires) of the relation. After deploying this charm, we can relate Loki and Promtail through loki_push_api relation interface:

juju relate promtail-k8s loki-k8s

And verify the relation between both charms is created:

juju status --color --relations
Model          Controller  Cloud/Region        Version  SLA          Timestamp
observability  mk8s        microk8s/localhost  2.9.21   unsupported  17:19:57-03:00

App           Version  Status  Scale  Charm         Store     Channel  Rev  OS          Address        Message
loki-k8s               active      1  loki-k8s      charmhub  edge      11  kubernetes  10.152.183.26
promtail-k8s           active      1  promtail-k8s  local                0  kubernetes  10.152.183.41

Unit             Workload  Agent  Address     Ports  Message
loki-k8s/0*      active    idle   10.1.51.38
promtail-k8s/0*  active    idle   10.1.51.26

Relation provider  Requirer              Interface      Type     Message
loki-k8s:logging   promtail-k8s:logging  loki_push_api  regular

Once the relation is established, Promtail charm can start sending logs to Loki charm.

Grafana-source

Grafana aggregates logs obtained by Loki and provides a versatile dashboard to view these logs in configurable ways. Loki relates to Grafana over the grafana_datasource interface.

For example, let’s say that we have already deployed the Grafana Charmed Operator in our observability model. The way to relate Loki and Grafana is again very simple:

juju relate grafana-k8s loki-k8s

And verify the relation between both charms is created:

juju status --color --relations
Model          Controller  Cloud/Region        Version  SLA          Timestamp
observability  mk8s        microk8s/localhost  2.9.21   unsupported  17:28:03-03:00

App           Version  Status  Scale  Charm         Store     Channel  Rev  OS          Address         Message
grafana-k8s            active      1  grafana-k8s   charmhub  edge      14  kubernetes  10.152.183.169
loki-k8s               active      1  loki-k8s      charmhub  edge      11  kubernetes  10.152.183.26
promtail-k8s           active      1  promtail-k8s  local                0  kubernetes  10.152.183.41

Unit             Workload  Agent  Address     Ports  Message
grafana-k8s/0*   active    idle   10.1.51.35
loki-k8s/0*      active    idle   10.1.51.38
promtail-k8s/0*  active    idle   10.1.51.26

Relation provider          Requirer                    Interface           Type     Message
grafana-k8s:grafana-peers  grafana-k8s:grafana-peers   grafana_peers       peer
loki-k8s:grafana-source    grafana-k8s:grafana-source  grafana_datasource  regular
loki-k8s:logging           promtail-k8s:logging        loki_push_api       regular

Requires

Alertmanager receives alerts from Loki, aggregates and deduplicates them, then forwards them to specified targets. Loki Charmed Operator relates to Alertmanager over the alertmanager_dispatch interface.

Let’s assume the we have already deployed Alertmanager Charmed Operator in our obsevability model, and relate it with Loki:

juju relate alertmanager-k8s loki-k8s

We can check the relation is established:

juju status --color --relations
Model          Controller  Cloud/Region        Version  SLA          Timestamp
observability  mk8s        microk8s/localhost  2.9.21   unsupported  17:34:39-03:00

App               Version  Status  Scale  Charm             Store     Channel  Rev  OS          Address         Message
alertmanager-k8s           active      1  alertmanager-k8s  charmhub  edge       7  kubernetes  10.152.183.136
grafana-k8s                active      1  grafana-k8s       charmhub  edge      14  kubernetes  10.152.183.169
loki-k8s                   active      1  loki-k8s          charmhub  edge      11  kubernetes  10.152.183.26
promtail-k8s               active      1  promtail-k8s      local                0  kubernetes  10.152.183.41

Unit                 Workload  Agent  Address     Ports  Message
alertmanager-k8s/0*  active    idle   10.1.51.29
grafana-k8s/0*       active    idle   10.1.51.35
loki-k8s/0*          active    idle   10.1.51.38
promtail-k8s/0*      active    idle   10.1.51.26

Relation provider          Requirer                    Interface              Type     Message
alertmanager-k8s:alerting  loki-k8s:alertmanager       alertmanager_dispatch  regular
alertmanager-k8s:replicas  alertmanager-k8s:replicas   alertmanager_replica   peer
grafana-k8s:grafana-peers  grafana-k8s:grafana-peers   grafana_peers          peer
loki-k8s:grafana-source    grafana-k8s:grafana-source  grafana_datasource     regular
loki-k8s:logging           promtail-k8s:logging        loki_push_api          regular

Help improve this document in the forum (guidelines). Last updated 8 months ago.