如果不會轉換IP(固定在ArangoDB 3.0中),您可以合併the TSV importer,因此您需要多一點轉換邏輯才能獲得有效的CSV。在導入過程中,將使用ede attribute conversion option將前兩列轉換爲有效的_from
和_to
屬性。
你不應該在其中指定空白的列主題,它應該是標籤或一個固定數量的列。我們需要在主題行中指定_from
和_to
字段。
爲了使其工作,你會管上面通過sed
得到有效CSV和適當的列名這樣的:
cat /tmp/test.tsv | \
sed -e "s;source IP;_from;g;" \
-e "s;target IP;_to;" \
-e "s; port;Port;g" \
-e 's; *;",";g' \
-e 's;^;";' \
-e 's;$;";' | \
arangoimp --file - \
--type csv \
--from-collection-prefix sourceHosts \
--to-collection-prefix targetHosts \
--collection "ipEdges" \
--create-collection true \
--create-collection-type edge
桑達與這些正則表達式將創建一箇中間表示看起來就像是:
"_from","_to","sourcePort","targetPort"
"192.168.84.3","192.189.42.52","5868","1214"
生成的邊緣看起來就像是:
{
"_key" : "21056",
"_id" : "ipEdges/21056",
"_from" : "sourceHosts/192.168.84.3",
"_to" : "targetHosts/192.189.42.52",
"_rev" : "21056",
"sourcePort" : "5868",
"targetPort" : "1214"
}
謝謝你。有Arangodb 3.0發佈日期嗎? (我知道它目前處於測試階段。) – Guido
本週晚些時候我們會談談。 RC3剛剛發佈。 – dothebart