我将 Logstash、Redis DB、ElasticSearch 和 Kibana 3 用于我的 centalize 日志服务器。它工作正常,我可以在 Kibana 中看到日志。现在我只想在 ElasticSearch 和 Redis 服务器上保留 30 天的日志。是否可以从 Redis 中清除数据?
我正在使用以下配置
indexer.conf
input {
redis {
host => "127.0.0.1"
port => 6379
type => "redis-input"
data_type => "list"
key => "logstash"
format => "json_event"
}
}
output {
stdout { debug => true debug_format => "json"}
elasticsearch {
host => "127.0.0.1"
}
}
托运人.conf
input {
file {
type => "nginx_access"
path => ["/var/log/nginx/**"]
exclude => ["*.gz", "error.*"]
discover_interval => 10
}
}
filter {
grok {
type => nginx_access
pattern => "%{COMBINEDAPACHELOG}"
}
}
output {
stdout { debug => true debug_format => "json"}
redis { host => "127.0.0.1" data_type => "list" key => "logstash" }
}
根据此配置,shipper 文件使用键“logstash”将数据发送到 Redis DB。从 redis db 文档中我了解到,我们可以使用 expire 命令为任何键设置 TTL 以清除它们。但是当我在 redis db 中搜索键“logstash”时,keys logstash
或者keys *
我没有得到任何结果。如果我的问题无法理解,请告诉我。提前致谢。