grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.83k stars 3.44k forks source link

promtail do not push logs to loki #11302

Open dossec opened 11 months ago

dossec commented 11 months ago

promtail do not push logs to loki,in the grafana dashboard to explorer use loki browser, I can not find the host 172.16.10.22,How can I resolve the problem,thks promtail version: 2.8.4 loki version: 2.8.4

config:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /usr/local/promtail/loki-positions.yaml
  sync_period: 30s

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

scrape_configs:
- job_name: front
  static_configs:
  - targets:
      - localhost
    labels:
      job: front2
      host: 172.16.10.22
      agent: promtail
      __path__: /var/log/nginx/access.log

client service status :

Nov 23 15:00:57 nginx02 systemd[1]: Started promtail server.
Nov 23 15:00:57 nginx02 promtail[113694]: level=info ts=2023-11-23T07:00:57.603880801Z caller=promtail.go:133 msg="Reloading configuration file" md5sum=38620a1649430b7eb66e629266513eed
Nov 23 15:00:57 nginx02 promtail[113694]: level=info ts=2023-11-23T07:00:57.605969921Z caller=server.go:323 http=[::]:9080 grpc=[::]:27539 msg="server listening on addresses"
Nov 23 15:00:57 nginx02 promtail[113694]: level=info ts=2023-11-23T07:00:57.606496381Z caller=main.go:174 msg="Starting Promtail" version="(version=2.8.4, branch=HEAD, revision=89d282c43)"
Nov 23 15:00:57 nginx02 promtail[113694]: level=warn ts=2023-11-23T07:00:57.606590104Z caller=promtail.go:265 msg="enable watchConfig"
Nov 23 15:01:02 nginx02 promtail[113694]: level=info ts=2023-11-23T07:01:02.605031048Z caller=filetargetmanager.go:358 msg="Adding target" key="/var/log/nginx/access.log:{agent=\"promtail\", host=\"172.16.10.22\", job=\"front02\"}"
Nov 23 15:01:02 nginx02 promtail[113694]: level=info ts=2023-11-23T07:01:02.605183018Z caller=filetarget.go:285 msg="watching new directory" directory=/var/log/nginx
Nov 23 15:01:02 nginx02 promtail[113694]: ts=2023-11-23T07:01:02.605438218Z caller=log.go:168 level=info msg="Seeked /var/log/nginx/access.log - &{Offset:653717 Whence:0}"
Nov 23 15:01:02 nginx02 promtail[113694]: level=info ts=2023-11-23T07:01:02.605459558Z caller=tailer.go:143 component=tailer msg="tail routine: started" path=/var/log/nginx/access.log
certram commented 11 months ago

Hello,does your promtail agent running in k8s cluster?And it runs as a daemonset kind.

dossec commented 11 months ago

Hello,does your promtail agent running in k8s cluster?And it runs as a daemonset kind.

No,the binary version

cstyan commented 10 months ago

Unfortunately with the logs you've provided I can't really make any suggestions, there should be metrics and logging about whether promtail is even trying to send data to loki.

slack channels or community forums are better places to ask usage related questions like this.