当前位置:网站首页>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
边栏推荐
- Solution of garbled code on idea console
- Summary according to classification in sail software
- 人脸识别框架之dlib
- Change the icon size of PLSQL toolbar
- Loading order of logback configuration file
- Hyperbdr cloud disaster recovery v3 Release of version 3.0 | upgrade of disaster recovery function and optimization of resource group management function
- logback的配置文件加载顺序
- 阿里研发三面,面试官一套组合拳让我当场懵逼
- Execution plan calculation for different time types
- OMNeT学习之新建工程
猜你喜欢

Cartoon: what are IAAs, PAAS, SaaS?

Postman batch production body information (realize batch modification of data)

Construction of esp32 compilation environment

阿里研发三面,面试官一套组合拳让我当场懵逼

451. 根据字符出现频率排序

Day (6) of picking up matlab

Six scenarios of cloud migration

Sort by character occurrence frequency 451
![[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return](/img/f5/15b3731e75eb4d861bd9d29ae244da.png)
[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return

Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
随机推荐
文件系统读写性能测试实战
Xinwangda: HEV and Bev super fast charging fist products are shipped on a large scale
MySql主从复制
基于GPU实例的Nanopore数据预处理
Oak-d raspberry pie cloud project [with detailed code]
[key points of final review of modern electronic assembly]
建站常用软件PhpStudy V8.1图文安装教程(Windows版)超详细
What is cloud migration? The four modes of cloud migration are?
logback的配置文件加载顺序
How to quickly batch create text documents?
G008-HWY-CC-ESTOR-04 华为 Dorado V6 存储仿真器配置
[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return
Review 2021: how to help customers clear the obstacles in the last mile of going to the cloud?
Sail soft implements a radio button, which can uniformly set the selection status of other radio buttons
Day (10) of picking up matlab
Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
What is homebrew? And use
JIRA screenshot
How to conduct application security test (AST)
Custom implementation of Baidu image recognition (instead of aipocr)