当前位置:网站首页>Construction of promtail + Loki + grafana log monitoring system
Construction of promtail + Loki + grafana log monitoring system
2022-04-23 16:36:00 【Autumnal equinox fishing fire】
Promtail + Loki + Grafana Log monitoring system construction
Introduction to the environment
The construction environment is centos8, Using two servers , among , Machine one is the application server , The other is a function server , Deploy java Application and Promtail , The function of server construction is loki+Grafana
Deploy the application server
install java, function java application , The default log path is /home/log/ Under the path
( Remember this path , stay Promtail The log path needs to be configured during configuration )
loki And promtail install
loki Download address
https://github.com/grafana/loki
Select the following installation package to download


After downloading the file , Use ftp Upload the file to the corresponding installation directory , Use unzip Path decompression
unzip loki-linux-amd64.zip
unzip promtail-linux-amd64.zip
After decompressing the two installation packages , Need to carry out loki And promtail Start of , There are no configuration files in the installation package of both , The configuration file needs to be generated manually for startup
https://grafana.com/docs/loki/latest/installation/local/
wget https://raw.githubusercontent.com/grafana/loki/master/cmd/loki/loki-local-config.yaml
wget https://raw.githubusercontent.com/grafana/loki/main/clients/cmd/promtail/promtail-local-config.yaml
The first is loki Configuration file for , The second is promtail Configuration file for , Download the configuration files of both and modify them
loki The configuration file
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
ruler:
alertmanager_url: http://localhost:9093
promtail The configuration file
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
// This corresponds to loki Service address of , You need to change this address to the server address of the service
clients:
- url: http://localhost:3100/loki/api/v1/push
scrape_configs:
// This corresponds to grafana Tag name in the interface
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
// This corresponds to the log storage path ,
__path__: /var/log/*log
start-up
Save the configuration file of the previous step as yaml file , Put it under the corresponding installation path , Execute the following command
// It has to be executed first loki The start command of , because promtail Startup time , Will start pushing logs , If loki Not activated , You're going to report a mistake
./loki-linux-amd64 -config.file=loki.yaml
./promtail-linux-amd64 --config.file=promtail-local-config.yaml
Grafana install
This installation uses yum Way to install
yum install grafana
After installation , Set power on self start
[root@localhost ~]# systemctl enable grafana-server
Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /usr/lib/systemd/system/grafana-server.service.
[root@localhost ~]# systemctl start grafana-serve
After setting up , Restart the server , Enter this machine ip:3000
grafana Operation diagram

Here we are ,grafana End of installation , Let's configure
grafana To configure
- Configure data sources

Click on addDataSource , Input loki Make a selection

To configure url, Here url Build for you loki Server address of the service , Port default 3100

After configuration, click save & test

The prompt appears , Represents successful configuration .

The label here corresponds to promtail The label of the configuration file in

You can see , The log of the application server has been refreshed to loki in , thus , from Promtail + Loki + Grafana The log monitoring system has been set up , At present, the tutorial corresponds to a single application service , A tutorial on clustering will follow , What if you want to know what happened , Let's hear the decomposition next time
Next time, there are already
Basic configuration and implementation of log monitoring system of cluster nginx Load balancing configuration
版权声明
本文为[Autumnal equinox fishing fire]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231402334599.html
边栏推荐
- ESP32_ Arduino
- Cloudy data flow? Disaster recovery on cloud? Last value content sharing years ago
- Gartner 發布新興技術研究:深入洞悉元宇宙
- 04 Lua operator
- What is homebrew? And use
- Es common query, sorting and aggregation statements
- Report FCRA test question set and answers (11 wrong questions)
- Vim使用Vundle安装代码补全插件(YouCompleteMe)
- What does cloud disaster tolerance mean? What is the difference between cloud disaster tolerance and traditional disaster tolerance?
- Construction of esp32 compilation environment
猜你喜欢

Grbl learning (I)

NVIDIA显卡驱动报错

昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案

What is cloud migration? The four modes of cloud migration are?

Hypermotion cloud migration completes Alibaba cloud proprietary cloud product ecological integration certification

Download and install mongodb

You need to know about cloud disaster recovery

建站常用软件PhpStudy V8.1图文安装教程(Windows版)超详细

OMNeT学习之新建工程

人脸识别框架之dlib
随机推荐
Sail soft segmentation solution: take only one character (required field) of a string
ESXi封装网卡驱动
LVM and disk quota
Best practice of cloud migration in education industry: Haiyun Jiexun uses hypermotion cloud migration products to implement progressive migration for a university in Beijing, with a success rate of 1
OAK-D树莓派点云项目【附详细代码】
05 Lua control structure
Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale
Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
Gartner 发布新兴技术研究:深入洞悉元宇宙
How to conduct application security test (AST)
Sort by character occurrence frequency 451
各大框架都在使用的Unsafe类,到底有多神奇?
Oracle data pump usage
Questions about disaster recovery? Click here
The first line and the last two lines are frozen when paging
Hypermotion cloud migration helped China Unicom. Qingyun completed the cloud project of a central enterprise and accelerated the cloud process of the group's core business system
无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
【Pygame小游戏】10年前风靡全球的手游《愤怒的小鸟》,是如何霸榜的?经典回归......
JSP learning 3
Hypermotion cloud migration completes Alibaba cloud proprietary cloud product ecological integration certification