As a test, I am trying to ingest the following simple XML file (the actual production file is huge).
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
...using the following Logstash pipeline configuration file:
input {
file {
path => [ "C:/temp/TEST/*.xml" ]
start_position => "beginning"
}
}
filter {
xml {
source => "message"
target => "doc"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "test-results-%{+YYYY.MM.dd}"
}
}
In Kibana, each element of the XML file shows up as its own "event", in this case there were 5 XML elements (e.g., <heading></heading>), so there are 5 hits:
What I want instead is to have one "hit" per document, with the XML elements as fields. So using the simple file as an example, there would be one hit with 5 fields. Is this possible?
Maybe part of the problem is that I'm not clear on how the source and target settings are to be used. That is, how do you create fields and then put the XML elements in the fields (for instance with xpath)?
