收集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