# Xml add field not working

**URL:** <https://discuss.elastic.co/t/xml-add-field-not-working/24070>\
**Category:** Logstash\
**Created:** [June 22, 2015, 10:10am UTC](https://discuss.elastic.co/t/xml-add-field-not-working/24070 "2015-06-22T10:10:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saket\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@Saket\_Kumar](https://discuss.elastic.co/u/Saket_Kumar)\
**Post date:** [June 22, 2015, 10:10am UTC](https://discuss.elastic.co/t/xml-add-field-not-working/24070/1 "2015-06-22T10:10:15Z")

</div>

filter {  
xml {  
add\_field =\> { "visualComplete" =\> "[response][data][median][firstView][visualComplete]" }  
}  
}

Logstash 1.5.0:  
Trying to add field "visualComplete" along with value and output to ELK but don't see any field with this name. Am I not doing it correctly.

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [June 23, 2015, 3:49am UTC](https://discuss.elastic.co/t/xml-add-field-not-working/24070/2 "2015-06-23T03:49:34Z")

</div>

The beginning of your filter is correct, though access existing fields would be %{fieldname} ....

From your example I don't see how you are creating the array of varables, Are you parsing the data prior to this filter ? Or I think you might find the option XPATH more to your liking

[https://www.elastic.co/guide/en/logstash/current/plugins-filters-xml.html#plugins-filters-xml-xpath](https://www.elastic.co/guide/en/logstash/current/plugins-filters-xml.html#plugins-filters-xml-xpath)

---

<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:** [July 6, 2017, 5:36am UTC](https://discuss.elastic.co/t/xml-add-field-not-working/24070/3 "2017-07-06T05:36:48Z")

</div>


