如果不会转换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