1.安装包下载地址
一般根据es的版本来确定logstash的版本,一般保持一致即可。
Logstash和es版本对应关系:https://www.elastic.co/cn/support/matrix#matrix_compatibility。
Logstash下载地址:https://www.elastic.co/cn/downloads/past-releases/logstash-7-8-0
2.解压并复制配置文件
3.配置配置文件
input {
file {
path => "/opt/app/logs/fast-boot/*.log"
type => "fast-boot"
exclude => "*.0.log"
start_position => "beginning"
}
file {
path => "/opt/app/logs/nginx/audit.log"
type => "nginx"
exclude => "*.0.log"
start_position => "beginning"
}
}
output {
if [type] == "fast-boot" {
elasticsearch {
hosts => ["http://192.168.137.101:9200"]
index => "app-fast-boot"
}
} else if [type] == "nginx" {
elasticsearch {
hosts => ["http://192.168.137.101:9200"]
index => "app-nginx"
}
}
stdout { codec => rubydebug }
}
4.启动项目
nohup bin/logstash -f config/logstash.conf > logstash.out 2>&1 &
标签:---,boot,app,离线,fast,centos7,nginx,type,logstash
From: https://www.cnblogs.com/hujunwei/p/18065058