# Input HTTP\_Poller Body with field issue

**URL:** https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002
**Category:** Logstash
**Created:** [February 26, 2019, 12:20pm UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002 "2019-02-26T12:20:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![romariol](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@romariol](https://discuss.elastic.co/u/romariol)
#### Post date: [February 26, 2019, 12:20pm UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/1 "2019-02-26T12:20:23Z")

</div>

Hi,

I'm using the http\_poller plugin as input where I perform a SOAP Call to an external system. It works perfectly fine while using a fixed body. However, the body contains date fields which must be the date of today. I can't get it to work to use previously defined fields in the body. I've created a small conf file, as shown below:

```
input {
  http_poller {
	add_field => {"[basedateSOAP]" => "%{+YYYY-MM-dd}"}
	add_field => {"[requestSOAP]" => '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><type><Start_Date>%{[basedateSOAP]}</Start_Date><End_Date>%{[basedateSOAP]}</End_Date></type></soapenv:Body></soapenv:Envelope>'}
	urls => { 
	soap_request => {
	method => post
	url => "https:/test.com"
	headers => {
	"Content-Type" => "text/xml; charset=utf-8"
	}
	#body => '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><type><Start_Date>%{[basedateSOAP]}</Start_Date><End_Date>%{[basedateSOAP]}</End_Date></type></soapenv:Body></soapenv:Envelope>'	
	body => "%{[requestSOAP]}"
}}   

request_timeout => 60
schedule => { cron => "* * * * * UTC"}
codec => "plain"
  }
}

output {
file {
            codec => plain {
                    format => "%{[message]} %{[basedateSOAP]} %{[requestSOAP]}"
            }
 path => "/tmp/logstash/output.log"
}
}

```

If tried in with both the first and second body. Both don't seem to accept a field.

Thanks in advance.

Best,

Romario

---

<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: [February 26, 2019, 1:00pm UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/2 "2019-02-26T13:00:47Z")

</div>

The add\_field is not executed until the input has successfully created an event, so you cannot reference those fields in setting the body.

---

<div class="post-metadata">

### Author: ![romariol](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@romariol](https://discuss.elastic.co/u/romariol)
#### Post date: [February 26, 2019, 1:06pm UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/3 "2019-02-26T13:06:14Z")

</div>

Thanks for your reply. Is there maybe another way to get the currentDate in the message body? I also tried to use %{+YYYY-MM-dd} in the body string. However, no luck.

---

<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: [February 26, 2019, 1:12pm UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/4 "2019-02-26T13:12:51Z")

</div>

Use an http filter instead of an http input, perhaps?

---

<div class="post-metadata">

### Author: ![romariol](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@romariol](https://discuss.elastic.co/u/romariol)
#### Post date: [February 26, 2019, 1:48pm UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/5 "2019-02-26T13:48:37Z")

</div>

I try to figure out how I can use SOAP in that case. I like the HTTP\_Poller for multiple reasons, so I really try to find a solution to have the currentDate in that body.

---

<div class="post-metadata">

### Author: ![romariol](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@romariol](https://discuss.elastic.co/u/romariol)
#### Post date: [March 11, 2019, 10:02am UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/6 "2019-03-11T10:02:52Z")

</div>

Fixed it via exec python

---

<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: [April 8, 2019, 10:04am UTC](https://discuss.elastic.co/t/input-http-poller-body-with-field-issue/170002/7 "2019-04-08T10:04:00Z")

</div>

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