# How to get field in xml?

**URL:** https://discuss.elastic.co/t/how-to-get-field-in-xml/249609
**Category:** Logstash
**Created:** [September 23, 2020, 5:56am UTC](https://discuss.elastic.co/t/how-to-get-field-in-xml/249609 "2020-09-23T05:56:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Luan\_Ph\_m](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luan_ph_m/32/28575_2.png) [@Luan\_Ph\_m](https://discuss.elastic.co/u/Luan_Ph_m)
#### Post date: [September 23, 2020, 5:56am UTC](https://discuss.elastic.co/t/how-to-get-field-in-xml/249609/1 "2020-09-23T05:56:15Z")

</div>

Hi

I need to get some field in my xml file but i don't know how to get it.

Here my xml

```auto
<?xml version="1.0"?>
<cluster>
  <cs_list>
    <cs>
      <id>1027</id>
      <status>active</status>
      <host_info>
        <host>10.0.0.1</host>
        <host_id>123</host_id>
        <location>0.0.0</location>
      </host_info>
    </cs>
    <cs>
      <id>1028</id>
      <status>active</status>
      <host_info>
        <host>10.0.0.1</host>
        <host_id>123</host_id>
        <location>0.0.0</location>
      </host_info>
    </cs>
  </cs_list>
</cluster>

```

I want to get

```auto
  [cs][id], [cs][id][status], [cs][id][location]

```

Thanks

---

<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 23, 2020, 1:57pm UTC](https://discuss.elastic.co/t/how-to-get-field-in-xml/249609/2 "2020-09-23T13:57:47Z")

</div>

Use an xml filter. There are many examples in this forum of how to configure it, such as [this](https://discuss.elastic.co/t/help-logstash-xml-parsing-to-xpath/241051/2) one.

---

<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: [October 21, 2020, 1:57pm UTC](https://discuss.elastic.co/t/how-to-get-field-in-xml/249609/3 "2020-10-21T13:57:47Z")

</div>

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