三个机器同时需要java环境,以及时间同步
rpm -ivh jdk-8u144-linux-x64.rpm
yum install -y elasticsearchvim /etc/elasticsearch/elasticsearch.yml
就可以访问了
node2和node3 配置文件
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install
yum install jdk-8u144-linux-x64.rpmyum install logstash-7.2.0.rpm
将日志同步到redis
input {
file {
path => "/var/log/nginx/access.log"
type => "nginx_access"
start_position => "beginning"
}
}
output {
redis {
host => "192.168.40.200"
port => "6379"
db => "1"
data_type => "list"
key => "logstash-list"
}
}
从redis中输出到 elasticsearch
input {
redis {
host => "192.168.40.200"
port => "6379"
db => "1"
data_type => "list"
key => "logstash-list"
}
}
output {
elasticsearch {
hosts => ["192.168.40.132:9200"]
index => "nginx-%{+YYYY.MM.dd}"
}
}
logstash -f test2.conf 运行即可