【发布时间】:2018-11-28 08:50:06
【问题描述】:
我在一个索引中有完整的数据库,我需要创建或获取 3 天的记录并以 CSV 格式存储。目标是每天需要 3 天的回溯记录并存储在 CSV 文件中。如何仅使用 logstash.config 设置从当前日期开始到最近 3 天?
我的 Logstash 配置文件
input {
elasticsearch {
hosts => "**Endpoint URL**"
index => "**Index NAME**"
user => "***"
password => "***"
query => '{ "query": { "query_string": { "query": "*" } } }'
}
}
filter {
csv {
separator => ","
autodetect_column_names => true
autogenerate_column_names => true
}
}
output {
stdout {
codec => json_lines
}
csv {
fields => []
path => "C:/ELK_csv/**cvs_File_Name**.csv"
}
}
需要添加日期过滤范围
{"query":{"bool":{"must":[{"range":{"createddate":{"gte":"","lt":""}}}],"must_not":[],"should":[]}},"from":0,"size":5000,"sort":[],"aggs":{}}
gte 从当前日期开始,持续 3 天。
【问题讨论】:
标签: elastic-stack logstash-configuration