请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

logstash整合elasticsearch问题

当我的mapping这样设计的时候

"mappings": {
    "doc":{
      "dynamic":false,
      "properties": {
        "time":{
          "type": "date"
        },
        "message_log":{
           "type": "text",
           "fields": {
             "keyword":{
               "type": "keyword"
             }
           }
        },
        "alarm_level":{
          "type": "keyword"
        },
        "alarmlevel":{
          "type": "integer"
        },
        "log_type":{
          "type": "keyword"
        },
        "log_topic":{
          "type": "keyword"
        },
        "source":{
           "type": "text",
           "fields": {
             "keyword":{
               "type": "keyword"
             }
           }
        },
        "host":{
          "type": "ip"
        }
      }
    }
  }
logtash向es中插入数据如何去掉多余的字段呢?


          "log_time": "May 21 10:57:44",
          "port": 6677,
          "offset": 5100,
          "host": "134.96.252.89",
          "@version": "1",
          "log_topic": "harbor_container_test",
          "@timestamp": "2018-08-07T07:15:34.552Z",
          "alarm_level": "ERROR",
          "message": [
            "May",
            "21",
            "10:57:44",
            "172.18.0.1",
            "jobservice[1226]:",
            "2018-05-21T02:57:44Z",
            "[ERROR]",
            "[utils.go:98]:",
            "failed",
            "to",
            "connect",
            "to",
            "tcp://adminserver:8080,",
            "retry",
            "after",
            "2",
            "seconds",
            ":dial",
            "tcp",
            "172.18.0.3:8080:",
            "getsockopt:",
            "connection",
            "refused"
          ],
          "time": "2018-05-21T10:57:44.000Z",
          "message_log": "May 21 10:57:44 172.18.0.1 jobservice[1226]: 2018-05-21T02:57:44Z [ERROR] [utils.go:98]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.3:8080: getsockopt: connection refused",
          "prospector": {
            "type": "log"
          },
          "log_type": "harbor_container",
          "component_name": "jobservice[1226]:",
          "source": "/apps/apps/app/filebeat-6.1.3-linux-x86_64/134.108.1.101_6606",
          "alarmlevel": "1",
          "beat": {
            "name": "ctgegh04",
            "hostname": "ctgegh04",
            "version": "6.1.3"
          }
        }

比如我上面的多余字段去掉logstash-output-elasticsearch里如何配置呢?我一直没找到demo;求大神来解决


正在回答 回答被采纳积分+3

1回答

rockybean 2018-08-07 17:13:59

去除字段可以用 logstash filter,参看 mutate remove_field

https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-remove_field

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信