instructions

The installation process recorded by yourself is used as information for your own use.

reference

Gitee.com/frankchenlo… www.cnblogs.com/mrhugui/p/1… www.soolco.com/post/94167_… Sbcode.net/grafana/ins… Sbcode.net/grafana/ins…

Install Loki

Wget wget HTTP: / / https://github.com/grafana/loki/releases/download/v2.1.0/loki-linux-amd64.zip https://github.com/grafana/loki/releases/download/v2.1.0/promtail-linux-amd64.zip wget https://raw.githubusercontent.com/grafana/loki/v2.1.0/cmd/loki/loki-local-config.yaml wget https://raw.githubusercontent.com/grafana/loki/v2.1.0/cmd/promtail/promtail-local-config.yaml/Loki - Linux - amd64 -config.file=loki-local-config.yaml # Open port 3100 firewall-cmd --zone=public --add-port=3100/ TCP --permanent firewall-cmd --reloadCopy the code

Install grafana

Wget https://dl.grafana.com/oss/release/grafana-7.4.3-1.x86_64.rpm sudo yum install grafana 7.4.3-1. X86_64. RPM service grafana-server startCopy the code

Setting boot

Grafana boots up

systemctl enable grafana-server
Copy the code

Loki boots up

cd /etc/systemd/system
touch loki.service
vim /etc/systemd/system/loki.service
Copy the code

Copy the following into loki.service

[Unit]
Description=Loki service
After=network.target

[Service]
Type=simple
ExecStart=/root/loki/loki-linux-amd64 -config.file /root/loki/loki-local-config.yaml

[Install]
WantedBy=multi-user.target
Copy the code
service loki start
service loki status
systemctl enable loki.service
Copy the code

Promtail is of the same class as Loki. Notice that the content of execstart is configured according to the actual directory

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

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

scrape_configs:
- job_name: test
  static_configs:
  - targets:
      - test
    labels:
      job: test
      host: localhost
      __path__: /home/logs/*/*/*log
Copy the code