grafanamonitoringgrafana-lokipromtail

Error: Unable to connect with Loki. Please check the server logs for more details on Grafana


I have installed Loki on my Ubuntu server and configured Promtail on another server to scrape logs. Grafana is also on the server where Loki is set up. The problem arises when I try to choose Loki as the data source; an error message appears as shown in the image. enter image description here

Now How to solve this problem. my promtail config file is this:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://35.22.35.29:3100/loki/api/v1/push

scrape_configs:
  - job_name: apache-logs
    static_configs:
      - targets:
          - localhost
        labels:
          job: apache
          __path__: /var/log/apache2/*.log

and my loki config file is this:

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  path_prefix: /etc/loki
  storage:
    filesystem:
      chunks_directory: /etc/loki/chunks
      rules_directory: /etc/loki/rules
  replication_factor: 1
  ring:
    instance_addr: 0.0.0.0
    kvstore:
      store: inmemory

schema_config:
  configs:
    - from: 2020-10-24
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h

ruler:
  alertmanager_url: http://localhost:9093

Solution

  • After many attempts, I discovered that the issue was caused by using an outdated version of Loki, which was 2.4.1. I updated to the latest version, 2.9.6, and this resolved my problem.

    Remember: Always try to install the latest version because developers fix issues in the latest releases.