# Ingest xml file using Logstash

**URL:** <https://discuss.elastic.co/t/ingest-xml-file-using-logstash/255113>\
**Category:** Logstash\
**Created:** [November 11, 2020, 6:34pm UTC](https://discuss.elastic.co/t/ingest-xml-file-using-logstash/255113 "2020-11-11T18:34:19Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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:** [November 11, 2020, 8:46pm UTC](https://discuss.elastic.co/t/ingest-xml-file-using-logstash/255113/7 "2020-11-11T20:46:24Z")

</div>

Use

`xml { source => "message" store_xml => true target => "theXML" }`

If you then need to move all the fields to the top level use a ruby filter, like [this](https://discuss.elastic.co/t/how-to-dynamically-move-nested-key-value-to-root-level/180006/2).

---

_[View the full topic](https://discuss.elastic.co/t/ingest-xml-file-using-logstash/255113)._
