一、Java安装
注意:java版本需要在1.8以上
下载安装
su -c "yum install java-1.8.0-openjdk-devel"
二、Elsasticsearch安装
2.1 下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.1.tar.gz
2.2 解压
tar -xzf elasticsearch-6.6.1.tar.gz
2.3 授权
2.4运行
cd elasticsearch-6.6.1/
./bin/elasticsearch
2.5 配置
(1) elasticsearch.yml
:配置elasticsearch;
(2) jvm.options
:配置elasticsearch的jvm设置
(3) log4j2.properties
:配置elasticsearch的日志记录
三、Logstash安装
3.1 下载
wget https://artifacts.elastic.co/downloads/logstash/logstash-5.5.1.tar.gz
3.2 解压
tar -xzf logstash-5.5.1.tar.gz
3.3 运行
cd logstash-6.6.1 bin/logstash -e 'input { stdin { } } output { stdout {} }'
3.4 配置
3.4.1 配置文件结构
# This is a comment. You should use comments to describe
# parts of your configuration.
input {
...
}
filter {
...
}
output {
...
}
3.4.2 配置文件示例
input {
file {
path => "/tmp/access_log"
start_position => "beginning"
}
}
filter {
if [path] =~ "access" {
mutate { replace => { "type" => "apache_access" } }
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
}
stdout { codec => rubydebug }
}
3.4.3 运行配置
bin/logstash -f configuration_file_name.conf
四、Filebeat安装
4.1 下载
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.6.1-linux-x86_64.tar.gz
4.2 解压
tar xzvf filebeat-6.6.1-linux-x86_64.tar.gz
4.3 配置
4.3.1 配置文件-- filebeat.yml
默认配置
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
#- c:\programdata\elasticsearch\logs\*
自定义配置
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["myEShost:9200"]
username: "filebeat_internal"
password: "YOUR_PASSWORD"
setup.kibana:
host: "mykibanahost:5601"
username: "my_kibana_user"
password: "YOUR_PASSWORD"
4.3.2 配置Filebeat输出日志到Logstash
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.logstash:
hosts: ["127.0.0.1:5044"]
4.4 运行
sudo chown root filebeat.yml sudo ./filebeat -e
4.5 重要参考配置文件-- filebeat.reference.yml
五、Kibana安装
5.1 下载
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.6.1-linux-x86_64.tar.gz
5.2 解压
tar -xzf kibana-6.6.1-linux-x86_64.tar.gz
5.3 运行
cd kibana-6.6.1-darwin-x86_64/
./bin/kibana
5.4 配置
5.4.1 配置文件--- kibana.yml
(1)与elasticsearch相关的配置
(2)与kibana输出日志相关的配置
(3)regionmap相关配置
(4)server相关配置
(5)tilemap相关配置