# Parsing xml using logstaash xpath

**URL:** https://discuss.elastic.co/t/parsing-xml-using-logstaash-xpath/119274
**Category:** Logstash
**Created:** [February 9, 2018, 4:38pm UTC](https://discuss.elastic.co/t/parsing-xml-using-logstaash-xpath/119274 "2018-02-09T16:38:48Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [February 9, 2018, 7:05pm UTC](https://discuss.elastic.co/t/parsing-xml-using-logstaash-xpath/119274/4 "2018-02-09T19:05:36Z")

</div>

Append some pattern that you are confident will not occur in the XML (easy in this case) then use a stdin input with a multiline codec. That should capture the XML as a single event, which you can start attacking with an xml filter.

```
(cat file.xml; echo "Monsieur Spalanzani n'aime pas la musique") | ./logstash -f ...
```

```
input{
  stdin {
    codec => multiline {
      pattern => "^Monsieur Spalanzani n'aime pas la musique"
      negate => "true"
      what => "previous"
    }
  }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/parsing-xml-using-logstaash-xpath/119274)._
