【问题标题】:Elasticsearch Mapping TemplateElasticsearch 映射模板
【发布时间】:2019-03-01 15:56:19
【问题描述】:

ELK 堆栈版本 6.2.1

我正在关注本教程并尝试将 tshark 捕获发送到 ELK。

https://www.elastic.co/blog/analyzing-network-packets-with-wireshark-elasticsearch-and-kibana

由于 tshark 将所有字段捕获为文本,我正在尝试在 elasticsearch 中创建一个映射,以确保数字字段被索引为整数、文本为字符串等...

因此,我需要创建一个弹性搜索映射,但对这是什么感到困惑。这是否意味着要创建一个像下面这样的索引模板

packets-index_pattern.json 包含以下条目

PUT _template/packets
{
  "template": "packets-*",
  "mappings": {
    "pcap_file": {
      "dynamic": "false",
      "properties": {
        "timestamp": {
          "type": "date"
        },
        "layers": {
          "properties": {
            "frame": {
              "properties": {
                "frame_frame_len": {
                  "type": "long"
                },
                "frame_frame_protocols": {
                  "type": "keyword"
                }
              }
            },
            "ip": {
              "properties": {
                "ip_ip_src": {
                  "type": "ip"
                },
                "ip_ip_dst": {
                  "type": "ip"
                }
              }
            },
            "udp": {
              "properties": {
                "udp_udp_srcport": {
                  "type": "integer"
                },
                "udp_udp_dstport": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}

到目前为止,我已经创建了一个名为 packet-index_pattern.json 的文件,并尝试使用以下内容将其上传到 Elasticsearch,但是我收到一条错误消息,提示状态 400 curl: (6) could not resolve host: Content-Type

curl -XPUT 'localhost:9200/_template/packets-?pretty' -H 'Content-Type: application/json'

欢迎接受任何帮助

【问题讨论】:

    标签: elasticsearch logstash


    【解决方案1】:

    TShark 现在支持-G elastic-mapping 选项。 https://www.wireshark.org/docs/relnotes/wireshark-3.0.0.html

    【讨论】:

      【解决方案2】:

      您在 json 之前插入的标头:

      PUT _template/packets
      

      它是用于指定动词(GET、POST、PUT 或 DELETE)和请求端点的 kibana 表示法。

      如果您使用 curl,则必须从您的 packet-index_pattern.json 文件中删除它。

      【讨论】:

      • 感谢达里奥!我会重击并报告!再次感谢我的朋友!
      猜你喜欢
      • 1970-01-01
      • 2015-08-10
      • 1970-01-01
      • 1970-01-01
      • 2012-07-11
      • 1970-01-01
      • 1970-01-01
      • 2015-02-02
      • 2021-01-27
      相关资源
      最近更新 更多