logstash+elasticsearch+kibana管理日志(安装)
logstash
1.先安装jdk
2.wget https://download.elastic.co/logstash/logstash/logstash-2.4.0.tar.gz
tar -xzvf logstash-2.4.0.tar.gz
cp -r logstash-2.4.0/ ../install/
进入install的logstash-2.4.0/bin目录
新建logstash.conf配置文件
input{
file{
type=>"nginx"
path=>["/software/installed/nginx/logs/access.log"]
}
}
output{
stdout { codec => rubydebug }
elasticsearch{
hosts => ["localhost:9200"]
}
}
3.安装elasticsearch_http插件
在logstash-2.4.0/bin目录
./logstash-plugin install logstash-output-elasticsearch_http
4安装elasticsearch
/software/download
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz
解压
cp -r elasticsearch-2.4.1 ../installed/
cd ../installed/elasticsearch-2.4.1/
启动elasticsearch
运行 bin/elasticsearch -d(注意不要使用root用户)默认 9200端口
curl http://localhost:9200
响应结果
{
"name" : "Tarot",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "EAjk35XHRxOS4y04kTtf7g",
"version" : {
"number" : "2.4.1",
"build_hash" : "c67dc32e24162035d18d6fe1e952c4cbcbe79d16",
"build_timestamp" : "2016-09-27T18:57:55Z",
"build_snapshot" : false,
"lucene_version" : "5.5.2"
},
"tagline" : "You Know, for Search"
}
表示运行正常
5 启动logstash
cd logstash-2.4.0/bin
./logstash -f logstash.conf
6.安装 kibana
/software/download
wget https://download.elastic.co/kibana/kibana/kibana-4.6.1-linux-x86_64.tar.gz
解压
cp -r kibana-4.6.1-linux-x86_64 ../installed/
进入到 installed/kibana-4.6.1-linux-x86_64下
vi config/kibana.yml
将 elasticsearch.url: "http://localhost:9200" 前的注释去掉
运行 ./bin/kibana 启动成功,默认5601端口
7.配置iptables 让5601端口可以外网访问
8访问
通过 http://192.168.1.125:5601/ 进行访问
配置索引模型
通过 Logstash 导入 Elasticsearch 的数据。默认 logstash-*
选择一个包含了时间戳的索引字段,可以用来做基于时间的处理
posted on 2016-10-10 20:23 xiezhengcai 阅读(424) 评论(0) 编辑 收藏 举报