相关疑难解决方法(0)

访问 Logstash 中的嵌套 JSON 字段

我在访问 logstash(最新版本)中的嵌套 JSON 字段时遇到问题。

我的配置文件如下:

input {
  http {
    port => 5001
    codec => "json"
  }
}

filter {
  mutate {
    add_field => {"es_index" => "%{[statements][authority][name]}"}
  }
  mutate {
    gsub => [
      "es_index", " ", "_"
    ]
  }
  mutate {
    lowercase => ["es_index"]
  }
  ruby {
    init => "
        def remove_dots hash
            new = Hash.new
            hash.each { |k,v|
                if v.is_a? Hash
                    v = remove_dots(v)
                end
                new[ k.gsub('.','_') ] = v
                if v.is_a? Array
                    v.each { |elem|
                        if elem.is_a? Hash
                            elem …
Run Code Online (Sandbox Code Playgroud)

json logstash

2
推荐指数
1
解决办法
7611
查看次数

标签 统计

json ×1

logstash ×1