当前位置:网站首页>Construction of promtail + Loki + grafana log monitoring system
Construction of promtail + Loki + grafana log monitoring system
2022-04-23 16:36:14 【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
边栏推荐
- 文件系统读写性能测试实战
- 阿里研发三面,面试官一套组合拳让我当场懵逼
- 建站常用软件PhpStudy V8.1图文安装教程(Windows版)超详细
- Gartner publie une étude sur les nouvelles technologies: un aperçu du métacosme
- Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
- File system read and write performance test practice
- Gartner announces emerging technology research: insight into the meta universe
- How magical is the unsafe class used by all major frameworks?
- [pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return
- 05 Lua control structure
猜你喜欢
-
04 Lua operator
-
100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
-
Cartoon: what are IAAs, PAAS, SaaS?
-
Nacos detailed explanation, something
-
Loading order of logback configuration file
-
Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
-
关于 background-image 渐变gradient()那些事!
-
vim编辑器的实时操作
-
磁盘管理与文件系统
-
RAID磁盘阵列与RAID5的创建
随机推荐
- LVM与磁盘配额
- Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale
- 5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
- 安装及管理程序
- NVIDIA显卡驱动报错
- 人脸识别框架之dlib
- Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
- Set cell filling and ranking method according to the size of the value in the soft report
- Solution of garbled code on idea console
- Use if else to judge in sail software - use the title condition to judge
- The font of the soft cell changes color
- Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
- Query the data from 2013 to 2021, and only query the data from 2020. The solution to this problem is carried out
- LVM and disk quota
- Creation of RAID disk array and RAID5
- Disk management and file system
- Real time operation of vim editor
- About background image gradient()!
- OMNeT学习之新建工程
- JMeter installation tutorial and solutions to the problems I encountered
- On the security of key passing and digital signature
- 文件操作详解(2)
- UWA Pipeline 功能详解|可视化配置自动测试
- Server log analysis tool (identify, extract, merge, and count exception information)
- Execution plan calculation for different time types
- Custom implementation of Baidu image recognition (instead of aipocr)
- MySQL personal learning summary
- Use itextpdf to intercept the page to page of PDF document and divide it into pieces
- DanceNN:字节自研千亿级规模文件元数据存储系统概述
- 众昂矿业:萤石浮选工艺
- 伪分布安装spark
- MySql主从复制
- Detailed explanation of UWA pipeline function | visual configuration automatic test
- 1959年高考数学真题
- Detailed explanation of file operation (2)
- Flask如何在内存中缓存数据?
- 计组 | 【七 输入/输出系统】知识点与例题
- 英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
- New project of OMNeT learning
- 昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案