收集node節點的日志
Promtail 配置檔案
配置檔案模闆檔案下載下傳位址
https://github.com/grafana/loki/tree/main/clients/cmd #自己用哪個用戶端收集就用下載下傳哪一個
[root@master ~]# kubectl get svc -n monitoring
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
loki ClusterIP 10.233.2.239 <none> 80/TCP,9095/TCP 13h
cat >> promtail-local-config.yaml <<EOF
server:
http_listen_port: 9080 #預設端口
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://10.1.16.189/loki/api/v1/push
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
EOF
[root@master promtail]# nohup ./promtail-linux-amd64 -config.file=promtail-local-config.yaml > log-promtail.file 2>&1 &
[1] 6664
[root@master promtail]# netstat -tpln | grep 9080
tcp6 0 0 :::9080 :::* LISTEN 6664/./promtail-lin