Putting server time in the request http poller body logstash


I have a logstash confg with uses http poller. The big problem I have is that, I need the current date sent in the body so the API knows what data to return. It doesn't work with relative dates, it needs the exact date to query.

So, I have tried many different ways to put the current server date in the body field of the request within the logstash.conf. Here is an example:

http_poller {
#proxy => { host => "" }
proxy => ""
urls => {
q1 => {
method => post
url => ""
headers => {.... }
body => '{
"rsid": "....",
"globalFilters": [
"type": "dateRange",
"dateRange": "%{+ddMMyyHHmmss}"
request_timeout => 60
# Supports "cron", "every", "at" and "in" schedules by rufus scheduler
schedule => { cron => "* * * * * UTC"}
codec => "json"
metadata_target => "http_poller_metadata"
output {
elasticsearch {
hosts => ["xxxx"]
index => "xxxx"

In every example I try, it just sends the raw value "%{+ddMMyyHHmmss}" and doesn't turn it into the current date. Any help would be really appreciated, I have done extensive searching but cant find the answer.

That appears to be a known issue.

1 Like

Thank you very much for that. It’s a shame it’s a known issue, is there any way to understand if it’s due to receive a fix any time soon?

I wouldn't hold my breath waiting for that :slight_smile:

Ok I’m now using Nifi which is a lot more powerful.

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