当前位置:网站首页>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
边栏推荐
- The most detailed knapsack problem!!!
- ES常用查询、排序、聚合语句
- OAK-D树莓派点云项目【附详细代码】
- Detailed explanation of gzip and gunzip decompression parameters
- TIA botu - basic operation
- There is a problem with the light switch from 1 to 100
- Grbl learning (I)
- Day (2) of picking up matlab
- NVIDIA显卡驱动报错
- Using JSON server to create server requests locally
猜你喜欢
TIA botu - basic operation
Summary according to classification in sail software
Solution of garbled code on idea console
Homewbrew installation, common commands and installation path
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
阿里研发三面,面试官一套组合拳让我当场懵逼
Nacos detailed explanation, something
Day (8) of picking up matlab
RecyclerView advanced use - to realize drag and drop function of imitation Alipay menu edit page
力扣-198.打家劫舍
随机推荐
ES常用查询、排序、聚合语句
On the security of key passing and digital signature
05 Lua 控制结构
The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
Day (9) of picking up matlab
linux上启动oracle服务
Solution of garbled code on idea console
Day 10 abnormal mechanism
各大框架都在使用的Unsafe类,到底有多神奇?
Redis "8" implements distributed current limiting and delay queues
Findstr is not an internal or external command workaround
LVM and disk quota
G008-HWY-CC-ESTOR-04 华为 Dorado V6 存储仿真器配置
Nacos 详解,有点东西
Sail soft calls the method of dynamic parameter transfer and sets parameters in the title
What is the experience of using prophet, an open source research tool?
logback的配置文件加载顺序
Review 2021: how to help customers clear the obstacles in the last mile of going to the cloud?
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
Differences between MySQL BTREE index and hash index