简体   繁体   English

logstash输入json删除根以进行Elasticsearch索引编制

[英]logstash input json remove root for elasticsearch indexing

Here is the json structure coming out from my input. 这是我输入的json结构。

"path" => "my/path",
    "@timestamp" => 2017-09-28T07:54:25.482Z,
      "@version" => "1",
          "host" => "linuxbox",
       "message" => "{\"top_val\":{\"birthday\":\"07/12/1991\",\"country\":\"India\"}"

Once i index this data to elasticsearch , i need to access this field in _source as top_val.birthday . 一旦我将这些数据索引到elasticsearch中,我就需要以top_val.birthday身份访问_source中的该字段。 How can i remove this top_val so that i can access the fields directly from _source. 我如何删除此top_val,以便可以直接从_source访问这些字段。 I know this can be done with arbitrary ruby code. 我知道这可以通过任意的ruby代码来完成。 But i believe there must be better ways to do it. 但是我相信必须有更好的方法来做到这一点。 Please help me with this. 请帮我解决一下这个。

放入ruby,在top_val所有字段之间循环,并将其移至事件的根。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM