学游者

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ELK搭建

零、注意
  • 每个微服务logstash的配置一个索索引
  • elasticsearch的索引管理根据服务名聚合
一、elasticsearch搭建
  • 下载&配置
"官网下载:"
https://www.elastic.co/cn/downloads/elasticsearch

"修改配置:elasticsearch.yml"
http.cors.enabled: true
http.cors.allow-origin: "*"

  • 启动
.\bin\elasticsearch.bat
  • Postman访问:
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"

posted on 2024-06-18 20:14  学游者  阅读(19)  评论(0)    收藏  举报