Nightingale Loki Data Source

Integrating Loki Data Source

In Data Source Management —> Click “Add” in the upper right corner —> Select Loki

l01

Fill in the relevant information as required. If the Loki service is not configured with multi-tenant mode, you don’t need to fill in the Header and Value below. The tenant ID can be obtained from the Loki administrator.

l02

How to confirm if multi-tenant mode is enabled? It’s simple—just make a request to the service without a tenant ID, and you can tell by the response. If you receive a “no org id” message, it means a tenant ID is required, as shown below.

l03

If you receive a normal response, then no tenant ID is required, as shown below.

l04

Querying Data

Scenario 1: Query each log line with a 401 status {container="evaluate-loki-flog-1"} | json | status="401"

l05

Scenario 2: Query the number of logs with a 401 status code in the last 5 minutes count_over_time({container="evaluate-loki-flog-1"} |= "401" [5m])

l06

Configuring Alerts

Alert Scenario: Trigger an alert if the number of logs with a 401 status code in the last 5 minutes is greater than 0

This alert scenario can be flexibly adjusted, such as replacing it with the number of occurrences of the keyword ERROR or any specific error code.

Select the Loki alert source in the alert configuration and configure the alert expression.

l07

After configuration, you can view the alert details in the alert history.

l08

Troubleshooting

If the alert configuration does not trigger as expected, you can check DEBUG.log to find related errors. You can search for the keywords “rule_eval” and “alert ID.”

l09

快猫星云 联系方式 快猫星云 联系方式
快猫星云 联系方式
快猫星云 联系方式
快猫星云 联系方式
快猫星云