version: "3"
networks:
loki:
services:
promtail:
image: grafana/promtail:2.7.0
restart: always
volumes:
- /var/log:/var/log
- ./config/promtail-config.yml:/etc/promtail/config.yml
command: -config.file=/etc/promtail/config.yml
networks:
- loki
config/promtail-config.yml
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://127.0.0.1:3100/loki/api/v1/push
scrape_configs:
- job_name: app
static_configs:
- targets:
- localhost
labels:
job: app
__path__: /var/log/app/**/*.log
ps:可以把127.0.0.1 换成接收端的内网ip