logstash.conf:
elasticsearch{
hosts => ["172.31.29.xxx:9200"]
index => "redis-%{+YYYYMMdd}"
}
我使用YYYYMMdd定义索引,我想改变索引时区,怎么做?
你可以使用 logstash "日期 "过滤插件 来改变日志事件时区。
下面是一个例子 logstash.conf
文件,我已经把它放在一起,向你展示日期过滤器是如何和在哪里。
input {
file {
...
type => "typeName"
}
}
filter {
if [type] == "typeName" {
grok {
match => {"message" => "^%{TIMESTAMP_ISO8601:event_timestamp}..."}
}
}
date {
match => [ "event_timestamp", "YYYY-MM-dd HH:mm:ss,SSS" ]
timezone => "Etc/GMT"
locale => "en"
}
}
output {
if [type] == "typeName" {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "indexName"
}
}
}
你可以看一下 这里有可用的时区值.