Configuring Decisions with Grafana Loki
  • 30 Oct 2023
  • 2 Minutes to read
  • Dark
    Light

Configuring Decisions with Grafana Loki

  • Dark
    Light

Article summary

Grafana Loki is a log aggregation tool that allows users to get logs from different Decision nodes into one place. This document demonstrates how to set up the Grafana and Loki for Decisions. For more information, refer to Grafana Loki Documentation.

Prerequisite

  • Loki Server
  • Grafana

Note: Both applications can be hosted on-premises or on Grafana Cloud.

Access Policies

To interact with the Grafana Cloud API, users must create two access policies. These access policies must be configured with the scope to Read and Write the Logs. Users must generate API tokens under both access policies. Specifically, the API Token with Read scope will enable Grafana to retrieve data from the Loki server, while the API Token with Write scope will facilitate Decisions in writing logs to the Loki server.


Configuring Loki Server in Decisions

  1. Log in to Decisions Studio, navigate to System > Settings > Logging Settings > Loki.
  2. Configure the following settings from the Loki window.

    Setting NameDescription
    Use Global SettingsThis will follow the settings configured under the Global Log settings, located at System > Settings > Logging Settings > Global.
    Is EnabledEnables the logging to the Loki Server.
    LevelsAllows to select the Log Level.
    Loki Server AddressEnter the Loki Server Address.
    • If Grafana is hosted on-premises, ensure to use the IP and the port number. http://[System IP]:[Port Number].
    • If using the Loki server on Grafana Cloud, the server address should resemble this format. https://[Domain Name].
    Application NameEnter the name of the application under which you want to store the logs. If no name is given, a new "Decisions" app will be created on the server to store the logs.
    Email or Username*Enter the User ID, which can be found at Grafana Stack. grafana.com/orgs/yourorganziation/hosted-logs/[User Id]
    Password*Enter the API Token generated for the access policy that is configured with Write Scope.
    *Not a compulsory field. If left blank, no authentication is added to the headers.


Configuring Loki Server in Grafana

  1. Navigate to the Grafana server and configure the Loki data source. Refer to the following table for required fields.

    Setting NameDescription
    Loki Server AddressEnter the Loki Server Address.
    • If Grafana is hosted locally, ensure to use the IP and the port number. http://[System IP]:[Port Number]
    • If using the Grafana Cloud, the server address should resemble this format. https://[Domain Name]
    Authentication Methods > Basic authenticationNot a compulsory field. If left blank, no authentication is added to the headers.
    UserEnter the User ID, which can be found at Grafana Stack. grafana.com/orgs/yourorganziation/hosted-logs/[User Id]
    PasswordEnter the API Token generated for the access policy that is configured with Read Scope.

  2. After configuring all the details, click on Save & test.
  3. The connection should be successful, and the following message should be displayed.

Troubleshooting the Loki Connection

Users might face a connection error with the following message

This validation will pop up when the URL in the Loki server is not the same as in the Decisions Loki settings. Ensure to push the Logs from the Decisions Server by configuring the server URL in Decisions Loki Settings first and then using the same URL in Loki Server so that the Loki database populates with the logs.


Accessing the Logs

  1. Navigate to Grafana > Menu (Hamburger Button) > Explore.
  2. Select the desired Loki from the drop-down. 
  3. Under Label Filters, set Application = [Application Name given in Decisions], and hit Run Query. The Logs will be generated.

Feature Changes

DescriptionVersionDateDeveloper Task
Add the Ability To Use Authenticated Loki Servers With Decisions8.15October 12, 2023
[DT-038823]

For further information on Administration, visit the Decisions Forum.

Was this article helpful?