Skip to content

Grafana Loki

Archived (pre-2022)

Preserved for reference only -- likely outdated. View original | Last updated: September 2021

Accessing Grafana Loki

Each EKS cluster has its own Grafana preconfigured with Dashboard as a code and Loki deployed.

You should be able to access it with Okta login/password (Login: @fyber.com).

Grafana EKS Resource Metrics Dashboard as a code - custom-dashboard.json (Bitbucket)

Cluster Region URL
OFW PRD Ireland Grafana
OFW STG Ireland Grafana
FAIRBID Ireland Grafana
FAIRBID Oregon Grafana
FAIRBID Virginia Grafana

Enabling log collection

By default Loki collects logs only from its own log collector container called Promtail. Thus we'll be using Promtail's logs for demonstration.

In order to get your logs into Loki the following annotation needs to be added to the Pod that you want to collect logs from:

  kind: Deployment
  spec:
    template:
      metadata:
        annotations:
          loki.io/scrape: "true"

Adding annotation on the fly also possible with kubectl:

kubectl annotate deployment MyDeployment loki.io/scrape=true

Seeing logs in Loki

Once logged in to Grafana UI, proceed to Explore:

Screenshot 2021-08-24 at 14.49.28.png

Choose Loki as datasource:

Screenshot 2021-08-25 at 13.35.35.png

Log browser allows quickly compile query from logs metadata available for Loki.

When needed labels selected - press Show logs:

Screenshot 2021-08-25 at 13.49.23.png

In the example above we want to see logs for Namespace: kube-system, Pod: grafana-promtail-main-s6s4q and Container: promtail

{container="promtail",namespace="kube-system",pod="grafana-promtail-main-s6s4q"}

The result will be similar to this:

Screenshot 2021-08-25 at 13.54.42.png

More on LogQL syntax

Visit Loki docs for details: Grafana - Logql