参考: http://m.blog.csdn.net/kuanghe121029/article/details/78086480
http://blog.csdn.net/weixin_38405770/article/details/78005263?skintest=skin3-template-test
官网下载elasticsearch、logstash和kibana的zip包
链接:https://www.elastic.co/
node.js 下载地址:http://download.csdn.net/download/lzjqcc/9988134
head插件:http://pan.baidu.com/s/1eSq1g5O 密码:dflq
1 安装elasticsearch
1.1 解压elasticsearch
1.2 修改配置文件 G:\syhenian\elasticsearch-5.6.3/config/elasticsearch.yml
cluster.name: my-application
node.name: node-1
path.data: G:\syhenian\elasticsearch-5.6.3\data
path.logs: G:\syhenian\elasticsearch-5.6.3\logs
network.host: 127.0.0.1
http.port: 9200
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
1.3 安装elasticsearch-head插件
a 下载head插件、node.js。
b 安装node.js(傻瓜式安装)
c 解压head文件到elasticsearch根目录下
d 安装grunt
npm install –g grunt–cli
如果安装grunt卡住了更换淘宝仓库
#更换
npm config set registry https://registry.npm.taobao.org
#验证
npm config set registry
#重装
npm cache clean
npm install -g grunt-cli
e 修改elasticsearch.yml
#添加
http.cors.enabled: true
http.cors.allow-origin: "*"
f 修改head目录下Gruntfile.js
connect: {
server: {
options: {
hostname: '0.0.0.0', #增加这行
port: 9100,
base: '.',
keepalive: true
}
}
}
1.4 elasticsearch根目录下创建data和logs文件夹
1.5 启动es
#head目录下执行
grunt server
#elasticsearch/bin目录下双击elasticsearch.bat
1.6 浏览器访问 http://localhost:9100
1.7 删除es索引
curl -XDELETE "http://localhost:8087/logstash-*"
2 安装logstash
2.1 解压logstash
2.2 config目录下创建文件http.conf
# 定义日志来源
input {
http {
host => "localhost"
port => 8087
}
}
filter {
# http 过滤非/hello前缀的url, 且请求传入 message为空时 则删除该信息
if ([headers][request_path] !~ '^\/procedure\/exception' or [message] == "") {
drop {}
}
}
output{
elasticsearch {
action => "index"
hosts => "localhost:9200"
}
stdout{codec => rubydebug}
}
2.3 bin目录下执行
logstash.bat -f ../config/http.conf
2.4 浏览器访问 http://localhost:9600/
2.5 logstash http采集
curl -XPUT "http://localhost:8087/hello" -d "hello world"
3 安装kibana
最简单,本地跑的话用默认配置就好了。
双击bin目录下的kibina.bat