出现这个问题是因为 elasticsearch 配置密码以后 logstash启动时连接 es 遇到认证问题,解决方法需要在logstash 配置文件中配置账号密码
vim /app/logstash/config/beat_es.conf
input {
beats {
port => 5044
}
}
filter {
#只对nginx的json日志做json解析,系统message为其他格式,无需处理
if [fields][log_type] == "nginx"{
json {
source => "message"
remove_field => ["beat","offset","tags","prospector"] #移除字段,不需要采集
}
date {
match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"] #匹配timestamp字段
target => "@timestamp" #将匹配到的数据写到@timestamp字段中
}
}
}
output {
if [fields][log_type] == "ruoyi" {
elasticsearch {
hosts => ["node1:9200","node2:9200"]
user => elastic
password => "123123"
index => "ruoyi_log"
timeout => 300
}
}
}



