# 定义日志源
input {
syslog {
type => "system-syslog" # 定义类型
port => 10514 # 定义监听端口
}
}
# 定义日志输出
output {
stdout {
codec => rubydebug # 将日志输出到当前的终端上显示
}
}
./logstash --path.settings /opt/logstash6.4.1/logstash-6.4.1/config/ -f /opt/logstash6.4.1/logstash-6.4.1/config/syslog.conf --config.test_and_exit
看到Configuration OK则无问题
6. 配置服务器的ip以及配置的监听端口
vim /etc/rsyslog.conf
添加下面内容
#### RULES ####
*.* @@192.168.1.10:10514
./logstash --path.settings /opt/logstash6.4.1/logstash-6.4.1/config/ -f /opt/logstash6.4.1/logstash-6.4.1/config/syslog.conf
input {
syslog {
type => "system-syslog"
port => 10514
}
}
output {
elasticsearch {
hosts => ["192.168.0.514:9200"] # 定义es服务器的ip
index => "system-syslog-%{+YYYY.MM}" # 定义索引
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容