我有两个文件,一个 xml 文件和一个 csv 文件。当我从 csv 文件中摄取数据时,我想从 xml 文件中添加字段。
这是我的 xml 的样子
<Root>
<Date>07.31.2015</Run>
<Customer>
<Name>John</Name>
<ID>12345</ID>
</Customer>
</Root>
这是我的 csv
column1,column2,column3
example1,example2,example3
example4,example5,example6
现在我想从 xml 文件中提取日期和 ID,并将这些字段添加到 csv 的每一行,当我将其拉入弹性搜索时,如下所示:
{
"_index" : "indx-2.0",
"_type" : "logfile",
"_id" : "abcdefg",
"_score" : 1.0,
"_source":{"message":["column1,column2,column3"],"Date":"07.31.2015", "CID": "12345"(etc)}
}
{
"_index" : "indx-2.0",
"_type" : "logfile",
"_id" : "abcdefh",
"_score" : 1.0,
"_source":{"message":["example1,example2,example3"],"Date":"07.31.2015", "CID": "12345"(etc)}
}
{
"_index" : "indx-2.0",
"_type" : "logfile",
"_id" : "abcdefi",
"_score" : 1.0,
"_source":{"message":["example4,example5,example6"],"Date":"07.31.2015", "CID": "12345"(etc)}
}
使用logstash可以实现这种事情吗(.conf文件会是什么样子)?