# Unable to load xml file in logstash

**URL:** <https://discuss.elastic.co/t/unable-to-load-xml-file-in-logstash/151318>\
**Category:** Logstash\
**Created:** [October 6, 2018, 1:32pm UTC](https://discuss.elastic.co/t/unable-to-load-xml-file-in-logstash/151318 "2018-10-06T13:32:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)\
**Post date:** [October 24, 2018, 10:21am UTC](https://discuss.elastic.co/t/unable-to-load-xml-file-in-logstash/151318/5 "2018-10-24T10:21:17Z")

</div>

The correct output is obtained for below input code, hope this helps other people,  
Also, max\_lines number changes based on the maximum number of lines present in your xml file

input  
{  
file  
{  
path =\> "C:/Users/LENOVO/Downloads/stations.xml"  
start\_position =\> "beginning"  
sincedb\_path =\> "NUL"  
codec =\> multiline {  
pattern =\> "^\<?stations.\*\>"  
negate =\> "true"  
what =\> "previous"  
auto\_flush\_interval =\> 1  
max\_lines =\> 3000  
}  
}  
}  
filter  
{  
xml  
{  
source =\> "message"  
target =\> "parsed"  
store\_xml =\> "false"  
xpath =\> [  
"/stations/station/id/text()", "station\_id",  
"/stations/station/name/text()", "station\_name"  
]  
}  
mutate {   
remove\_field =\> ["message"]   
}  
}

output  
{  
stdout  
{  
codec =\> rubydebug  
}  
}

---

_[View the full topic](https://discuss.elastic.co/t/unable-to-load-xml-file-in-logstash/151318)._
