部署
docker run -dti -p 3000:3000 grafana/grafana:master
docker run -dti -p 3100:3100 --name loki grafana/loki:2.4.1
docker run -dti --name promtail grafana/promtail:2.4.1 -config.file=/etc/promtail/config.yml
mkdir -p /data/soft/promtail
docker cp promtail:/etc/promtail/config.yml /data/soft/promtail/config.yml
修改配置
vim /data/soft/promtail/config.yml
server: http_listen_port: 9080 grpc_listen_port: 0 positions: filename: /tmp/positions.yaml clients: - url: http://192.168.228.163:3100/loki/api/v1/push scrape_configs: - job_name: system static_configs: - targets: - localhost #本地 labels: job: varlogs #job任务 __path__: /usr/local/nginx/logs/*log #配置监控路径
挂载 nginx 日志文件目录和 promtail 配置文件到容器
docker stop promtail && docker rm promtail
docker run -dti --name promtail -v /usr/local/nginx/logs/:/usr/local/nginx/logs/ -v /data/soft/promtail/config.yml:/etc/promtail/config.yml grafana/promtail:2.4.1 -config.file=/etc/promtail/config.yml
访问测试
http://192.168.228.163:3000/login #默认账户密码admin
标签:promtail,grafana,Loki,run,docker,config,yml,轻量级 From: https://www.cnblogs.com/libruce/p/16825672.html