ELK搭建
零、注意
- 每个微服务logstash的配置一个索索引
- elasticsearch的索引管理根据服务名聚合
一、elasticsearch搭建
"官网下载:"
https://www.elastic.co/cn/downloads/elasticsearch
"修改配置:elasticsearch.yml"
http.cors.enabled: true
http.cors.allow-origin: "*"
.\bin\elasticsearch.bat
GET http://localhost:9200/customer/_search
二、elasticsearch-head搭建
"github下载"
https://github.com/mobz/elasticsearch-head/tags
npm install
npm run start
http://localhost:9100/
![]()
三、kibana搭建
"官网下载"
https://www.elastic.co/cn/downloads/kibana
.\bin\kibana.bat
http://localhost:5601/app/home#/
![]()
四、logstash搭建
"官网下载"
https://www.elastic.co/cn/downloads/logstash
"新建配置 *.config"
input {
file {
type = "legend_index" "配置文件的标识"
path = ["D:/project/work/legend-index/logs/*.log"] "文件路径"
start_position = "beginning"
}
}
output {
elasticsearch {
hosts = ["http://localhost:9200"]
index = "legend-index-local" "每个监控都应该有独立索引名"
}
}
"1、配置index:http://localhost:5601/app/management/kibana/spaces"
"2、在分栏:Index patterns。新增索引:legend-index-*"
http://localhost:5601/app/discover#/
搜索: message : "insert into"
![]()