我对filebeat和elasticsearch非常陌生。我正在做一个业余项目,我想解析我的数据文件。每个数据文件都包含如下所述的信息格式,
<name>
<question>
<ans1>
<ans2>
<ans3>
..etc
我想读取这些数据并存储在es中
{
id : <separate_id_for_each_file>,
name: <name>,
question: <question>,
ans1: <ans1>, ..etc
}
我该如何使用filebeat?
最佳答案
到目前为止,您无法使用filebeat进行此操作。
您将需要将日志发送到logstash,然后使用grok这样的插件将其转换,然后再将其发送到elastic,如果您希望在日志中添加ID,则可以在将其发送到grok之前使用uuid插件。
Filebeat的目的只是为了让收割女巫读取您的日志并发送然后转发
因此,您的流程将类似于:filebeat> LOGSTASH [uuid,grok]> ElasticSearch
如果您需要grok模式的示例,这些可能会有用:
希腊模式的集合:
https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns
Grok模式测试仪:
http://grokconstructor.appspot.com/do/match
关于elasticsearch - 如何格式化Filebeat中的日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40375142/