【发布时间】:2019-07-11 15:29:21
【问题描述】:
我是第一次尝试Elasticsearch。
我已经下载了Elasticsearch 和Kibana,一切似乎都运行良好。我可以访问http://localhost:5601 并查看Kibana 而不会出错。
我已经使用wireshark/tshark 进行了一些跟踪,并将其转换为Elasticsearch 格式:
tshark -r test_trace.pcap -T ek > test_trace.pcap.json
现在我正在尝试将 .json 导入到 Elasticsearch,但它似乎失败了:
curl -s -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/foo/_bulk" --data-binary "@/Users/test-elastic/test_trace.pcap.json"
我没有收到任何错误或任何输出,但访问 Kibana 显示 index_not_found_exception 并运行:
curl 'http://127.0.0.1:9200/foo/_search/?size=10&pretty=true'
输出
{
"error" : {
"root_cause" : [
{
"type" : "index_not_found_exception",
"reason" : "no such index",
"resource.type" : "index_or_alias",
"resource.id" : "foo",
"index_uuid" : "_na_",
"index" : "foo"
}
],
"type" : "index_not_found_exception",
"reason" : "no such index",
"resource.type" : "index_or_alias",
"resource.id" : "foo",
"index_uuid" : "_na_",
"index" : "foo"
},
"status" : 404
}
如何正确导入我的数据并在Elasticsearch 和Kibana 中查看?
JSON 文件为 195MB,由 10MB PCAP 文件转换而来。
json 文件中第一行的输出是:
{"index" : {"_index": "packets-2019-02-15", "_type": "pcap_file", "_score": null}}
{"timestamp" : "1549540104875", "layers" : {"frame": {"frame_frame_interface_id":...
更新
在curl 中删除-s 后,我得到了输出:
HTTP/1.1 413 Request Entity Too Large
现在我尝试使用split 将文件拆分为多个较小的文件。
现在再次测试导入会给我多个错误:
..."reason":"failed to parse","caused_by":{"type":"json_parse_exception","reason":"Duplicate field 'ip_ip_addr'\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@5d2f82db; line: 1, column: 1300...
更新
我在test_trace.pcap.json 上使用了以下命令来获取更小的文件:
split -l 10000 -a 10 test_trace.pcap.json.pcap.json ./tmp/test_trace.pcap
然后我得到了很多文件并用第一个文件测试了导入:
./tmp/test_trace.pcapaaaaaaaaaa
我.json中的文件类型是:
"frame_frame_protocols": "sll:ethertype:ip:sctp"
确实有多个 ip_ip_addr 字段,因为我在跟踪中具有源 IP 地址和目标 IP 地址。
【问题讨论】:
-
你能把
test_trace.pcap.json的前几行也显示一下吗?这个文件有多大? -
当然,完成:)
标签: elasticsearch kibana filebeat tshark