# XML filter in logstash

**URL:** <https://discuss.elastic.co/t/xml-filter-in-logstash/250291>\
**Category:** Logstash\
**Created:** [September 29, 2020, 5:37am UTC](https://discuss.elastic.co/t/xml-filter-in-logstash/250291 "2020-09-29T05:37:43Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [September 30, 2020, 6:21pm UTC](https://discuss.elastic.co/t/xml-filter-in-logstash/250291/9 "2020-09-30T18:21:22Z")

</div>

If you consume the file one line at a time, which is what a file input does by default, then many of your lines will not be valid XML and the xml filter will not parse them. For example ...

```
<measInfo measInfoId="PM=1,PmGroup=FieldReplaceableUnit">

```

is not a valid XML document, since the opening measInfo tag is not closed.

If you want to consume the whole file as one event then [this](https://discuss.elastic.co/t/parsing-array-of-json-objects-with-logstash-and-injesting-to-elastic/203197/2) post shows you how to do it.

---

_[View the full topic](https://discuss.elastic.co/t/xml-filter-in-logstash/250291)._
