Well,不要刷屏了
从问题 ES调用script 奇怪错误 跳转而来

困扰好久的 elk 收集自定义日志的mapping问题

Logstash | 作者 woniu | 发布于2017年04月27日 | 阅读数:8154

配置文件如下:
input {
  file {
        path=> [ "/log/123.log" ]
        codec => plain { charset => "GB2312" }
  }
}
filter {
  grok {
    match => { "message" => "(?<date_time>^\d{6}[/-]\d{2}:\d{2}:\d{2}) %{NUMBER:accid} %{NUMBER:charid} %{WORD}:%{IPV4:client} %{WORD}:%{NUMBER:yanshi}"}
}
}
output {
  elasticsearch {
        hosts => "172.29.211.41"
        index => "gw1704"
        manage_template => true
        template_name => "gw1704"
        template =>"/home/ztgame/elk/logstash-2.4.1/templates/gw.json"

}
}
 
 
mapping 是复制的默认的logstash的默认的。
只更改了如下部分
 
{
      "template" : "gw1704"
      "order" : 2,
      "mappings" : {
         "_default_" : {
         "dynamic_templates" : [ {
         "message_field" : {
             "match" : "message",
             "match_mapping_type" : "string",
         "mapping" : {
             "type" : "string", "index" : "analyzed", "omit_norms" : true,
             "fielddata" : { "format" : "disabled" },
             "charid":{"type":"number"}, #增加部分
             "client":{"type":"ip"},#增加部分
             "yanshi":{"type":"number"}#增加部分
          }
......
 
重启logstash 没有生效获取mapping 空的,然后尝试 用 
 curl -XPUT 172.29.211.41:9200/_template/gw1704   -d /home/ztgame/elk/logstash-2.4.1/templates/gw.json 加载
 结果报错,报错信息如下:
 
{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derive xcontent"}],"type":"parse_exception","reason":"Failed to derive xcontent"},"status":400}
 
 
 
谢谢各位了!!!这个问题卡了几天了。 
已邀请:

jiakechong1642

赞同来自:

hosts => "172.29.211.41"      这个是不是有问题呢,你的端口呢?   hosts => "172.29.211.41:9200" 试试

jiakechong1642

赞同来自:

解决了吗?

要回复问题请先登录注册