How to parse date in elasticsearch 5.x and Filebeat
我正在使用elasticsearch 5.x和Filebeat,想知道是否有一种直接在filebeat中解析日期(时间戳)的方法(不想使用Logstash)。我正在使用
如何将其映射为日期?
您可以将Filebeat与ES Ingest Node功能一起使用来解析您的
您将在Elasticsearch中设置一个简单的管道,该管道将日期应用于传入事件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | PUT _ingest/pipeline/my-pipeline { "description" :"parse timestamp and update @timestamp", "processors" : [ { "date" : { "field" :"timestamp", "target_field" :"@timestamp" } }, { "remove": { "field":"timestamp" } } ], "on_failure": [ { "set": { "field":"error.message", "value":"{{ _ingest.on_failure_message }}" } } ] } |
然后在Filebeat中配置elasticsearch输出以将数据推送到新管道。
1 2 3 | output.elasticsearch: hosts: ["http://localhost:9200"] pipeline: my-pipeline |