How to import data from 2 urls and with different index using http_roller in logstash conf file

input {
	http_poller {
		urls => {
 			"1" => {
				type => "article"
				method => GET
 				url => "https://personel.klu.edu.tr/elasticsearch/datasets/makale_bilgisi.json"
 				headers => {
 					Accept => "application/json"
 				}
			}
			"2" => {
				type => "askd"
				method => GET
 				url => "https://personel.klu.edu.tr/elasticsearch/datasets/askd_bilgisi.json"
 				headers => {
 					Accept => "application/json"
 				}
			}
 		}
		codec => "json_lines"
		request_timeout => 60
		schedule => { "in" => "0" }
		metadata_target => "http_poller_metadata"
	}
}
filter {
	json{
		source => "message"
	}
	mutate {
		remove_field => ["@version","@timestamp","path","host", "tags","response_headers","http_poller_metadata","version", "message"]
	} 
}
output {
	stdout {codec => rubydebug}
	if [urls] == ["1"]
	{
    		elasticsearch {
			hosts => ["http://localhost:9200"]
			user => "elastic"
    			password => "123456"
			index => "article"
		}
	}else if [urls] ==["2"]
	{
    		elasticsearch {
			hosts => ["http://localhost:9200"]
			user => "elastic"
    			password => "123456"
			index => "askd"
		}	
	}
}

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