【发布时间】:2016-05-03 14:39:55
【问题描述】:
如何使用 Logstash 将数据从 Elasticsearch 导出到 CSV?我只需要包含特定的列。
【问题讨论】:
标签: elasticsearch logstash export-to-csv
如何使用 Logstash 将数据从 Elasticsearch 导出到 CSV?我只需要包含特定的列。
【问题讨论】:
标签: elasticsearch logstash export-to-csv
安装 2 个plugins:elasticsearch input plugin 和csv output plugin。 然后创建a configuration file。这里是a good example for this particular case。
您现在可以开始了,只需运行:bin/logstash -f /path/to/logstash-es-to-csv-example.conf
并检查output -> csv -> path中指定的export.csv文件。
【讨论】:
重要提示:
使用 Logstash 5.x 时,csv 输出插件中存在一个已知错误。该插件生成一个%{host} %{message}%{host} %{message}%{host} %{message} 的字符串。
有一个未解决的问题:https://github.com/logstash-plugins/logstash-output-csv/issues/10
作为一种解决方法,您可以:
改用文件输出
file {
codec => line { format => "%{field1},%{field2}"}
path => "/path/to/data_export.csv"
}
根据github讨论修改插件代码...
【讨论】: