# Filtering XML input in Logstash

**URL:** <https://discuss.elastic.co/t/filtering-xml-input-in-logstash/112606>\
**Category:** Logstash\
**Created:** [December 20, 2017, 10:27am UTC](https://discuss.elastic.co/t/filtering-xml-input-in-logstash/112606 "2017-12-20T10:27:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![moriol](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@moriol](https://discuss.elastic.co/u/moriol)\
**Post date:** [December 20, 2017, 10:27am UTC](https://discuss.elastic.co/t/filtering-xml-input-in-logstash/112606/1 "2017-12-20T10:27:10Z")

</div>

Hello,

I have an XML file as an input in Logstash. I want to process and store only the header of the input, I dont care about the rest of the file. I have an input configured such as:  
file {  
path =\> "/home/test/file.xml"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
codec =\> multiline {  
pattern =\> "Header"  
negate =\> false  
what =\> "previous"  
}  
}  
My configuration partially works as I read the data from header, but then I get a number of JSON outputs, containing just the timestamp, as the data after the header is not matched. I would like to keep the header, but not the "empty" JSON output afterwards. Whats the best way to configure my input, to only match the header and ignore the rest?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 17, 2018, 10:27am UTC](https://discuss.elastic.co/t/filtering-xml-input-in-logstash/112606/2 "2018-01-17T10:27:30Z")

</div>

Closed on January 17, 2018, 10:27am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
