繁体   English   中英

Logstash弹性搜索输出自定义模板不起作用

[英]Logstash elastic search output custom template not working

我的logstash配置如下所示

if "user" in [tags] {
        elasticsearch {
            hosts => ["localhost:9200"]
            action => "index"
            index => "user-%{+YYYY.MM.dd}"
            template => '/path/to/elastic-template.json'
            flush_size => 50
        }
}    

并且json模板包含以下行

 "fields" : {
                 "{name}" : {"type": "string", "index" : "analyzed", "omit_norms" : true, "index_options" : "docs"},
                 "{name}.raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256}
               }

因此,我假设在搜索或生成可视化效果时可以使用.raw

但是,我删除了现有索引并再次重建,可以看到数据,但是仍然找不到Kibana的设置,发现或可视化的.raw字段。

如何使用.raw字段?

您发布的模板甚至不是有效的JSON。 如果要像not_analyzed一样应用raw字段, not_analyzed必须这样做:

"action" : {
  "type" : "string",
    "fields" : {
      "raw" : {
        "index" : "not_analyzed",
        "type" : "string"
    }
  }
}

这将创建一个action.raw字段。

我遇到了同样的问题。 我使用了ES5.5.1logstash 5.5.1 ,下面是我的模板文件

{
  "template": "access_log",
  "settings": {
    "index.refresh_interval" : "5s"
  },
  "mappings": {
    "log": {
      "properties":{
        "geoip":{
          "properties":{
             "location" : {
               "type" : "geo_point",
               "index": "false"
             }
          }
        }
      }
    }
  }
}

暂无
暂无

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

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