Dynamic variable in Http_poller url

Hi all,

i try to make the endDate in the url , dynamic ( take the date of the system) ?

but i got error in logstash .

[2020-09-25T10:24:22,616][INFO ][logstash.outputs.elasticsearch][main] Attempting to install template {:manage_template=>{"index_patterns"=>"logstash-", "version"=>60001, "settings"=>{"index.refresh_interval"=>"5s", "number_of_shards"=>1}, "mappings"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}
[2020-09-25T10:24:23,459][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {"seconds"=>0.86}
[2020-09-25T10:24:23,482][INFO ][logstash.inputs.http_poller][main] Registering http_poller Input {:type=>nil, :schedule=>{"every"=>"60s"}, :timeout=>nil}
[2020-09-25T10:24:24,475][ERROR][logstash.agent ] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create, action_result: false", :backtrace=>nil}
[2020-09-25T10:24:24,981][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2020-09-25T10:24:29,686][INFO ][logstash.runner ] Logstash shut down.
[2020-09-25T10:24:29,712][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit

and this is my config file:
input {

http_poller {
	urls => {
		url2020 => "http://XXXXXXXXXXXX?startDate=01/01/2020&endDate=%{now}"
	}
	request_timeout => 60
	schedule => { "every" => "60s"  }
	codec => "json"
}

}

can someone help me please !
Hiba.

Not sure if this is possible as part of the input plugin
I am pretty sure that is possible in filter
May be @Badger can have an idea

See this answer.

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