"No logs found" in grafana

Viewed 951

I installed Loki, grafana and promtail and all three runing. on http://localhost:9080/targets Ready is True, but the logs are not displayed in Grafana and show in the explore section "No logs found"

promtail-local-config-yaml:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

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

scrape_configs:
- job_name: system
  static_configs:
  - targets:
      - localhost
    labels:
      job: varlogs
      host: ward_workstation
      agent: promtail
      __path__: D:/LOGs/*log

loki-local-config.yaml:

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  path_prefix: /tmp/loki
  storage:
    filesystem:
      chunks_directory: /tmp/loki/chunks
      rules_directory: /tmp/loki/rules
  replication_factor: 1
  ring:
    instance_addr: 127.0.0.1
    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

How can i solve this problem?

1 Answers

Perhaps you are using Loki in Windows ?

In your promtail varlogs job ,the Path "D:/LOGs/*log" is obviously wrong, you cannot access the windows file from your docker directly.

You shoud mount your windows file to your docker like this:

  promtail:
    image: grafana/promtail:2.5.0
    volumes:
      - D:/LOGs:/var/log
    command: -config.file=/etc/promtail/config.yml
    networks:
      - loki

Then everything will be ok.

Note that, in your promtail docker the config is like this: enter image description here

you can adjust both to make a match...

Related