配置 Logstash 收集 Rsyslog 日志

配置文件:/etc/logstash/conf.d/logstash-indexer.conf

input {
    #file {
    #    path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
    #    type => "syslog"
    #}
    #redis {
    #    host => "192.168.10.1"
    #    type => "redis-input"
    #    data_type => "list"
    #    key => "logstash"
    #} 
    tcp {
        port => "1514"
        type => "syslog"
    }
    udp {
        port => "1514"
        type => "syslog"
    }
}

output {
    elasticsearch { hosts => ["localhost:9200"] }
}

客户端rsyslog配置

编辑/etc/rsyslog.conf文件,最后面添加以下行:

.* @@192.168.22.205:1514

重启rsyslog:

service rsyslog restart

测试:

logger -p info "hello, rsyslog"

查看kibana是否有相关日志。

posted @ 2021-08-20 09:22  Varden  阅读(538)  评论(0编辑  收藏  举报