Logstash xml过滤器

时间:2018-09-05 02:40:44

标签: elasticsearch logstash

我想一次存储以下xml格式数据。

<title>name</title>
<destination>my name</destination>
<log>hi~ my name is taewoo!</log>
<date>2018-09-04T09:00:00</date>

但是,每个字段分别存储,创建三个文档。

下面是配置文件。

input {
    file {
        path => "/usr/local/ELK/logstash-6.3.2/config/test1.xml"
        start_position => "beginning"
        type => "xml"
    }
}
filter {
    xml {
        remove_namespaces => true
        source => "message"
        xpath => ["/title", "title",
                  "/destination", "destination",
                  "/log", "log",
                  "/date", "date"]
        target => "doc"
        store_xml => true
    }
}
output {
    elasticsearch {
        hosts => ["127.0.0.1:9200"]
        index => "t4"
#        document_type => "test"
        user => "elastic"
        password => "root123"

    }
    stdout {}
}

0 个答案:

没有答案