stat_interval => “2”
}
}
output {
if [type] == “systemlog” {
redis {
data_type => “list”
host => “192.168.1.31”
db => “6”
port => “6379”
password => “123456”
key => “systemlog”
}
}
}
2丶启动
logstash -f /etc/logstash/conf.d/redis.conf -t
logstash -f /etc/logstash/conf.d/redis.conf
3丶写入日志到messages日志中
cat /etc/hosts >>/var/log/messages
4丶登录redis查看
redis-cli -h 192.168.1.31
192.168.1.31:6379> auth 123456
OK
192.168.1.31:6379> select 6
OK
192.168.1.31:6379[6]> keys *
- “systemlog”
192.168.1.31:6379[6]> llen systemlog
(integer) 11292
192.168.1.31:6379[6]> lpop systemlog