# Separate indexing from multiple sources in one logstash file

**URL:** <https://discuss.elastic.co/t/separate-indexing-from-multiple-sources-in-one-logstash-file/222206>\
**Category:** Logstash\
**Created:** [March 5, 2020, 6:32am UTC](https://discuss.elastic.co/t/separate-indexing-from-multiple-sources-in-one-logstash-file/222206 "2020-03-05T06:32:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kanika\_Agarwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kanika_agarwal/32/45151_2.png) [@Kanika\_Agarwal](https://discuss.elastic.co/u/Kanika_Agarwal)\
**Post date:** [March 5, 2020, 6:32am UTC](https://discuss.elastic.co/t/separate-indexing-from-multiple-sources-in-one-logstash-file/222206/1 "2020-03-05T06:32:58Z")

</div>

Hi, I am trying to pull data from Git using flask and then uploading it on Elastic. We are using 3 APIs and the flask is giving us the required results. But when we try to index it using http\_poller plugin in one .conf file, by using if else condition it is uploading all the 3 APIs data in all the indexes. But we need each API to be indexed separately. Below is the .conf file.  
input{  
http\_poller{  
urls =\> {  
"1" =\> {  
method =\> get  
url =\> "[http://127.0.0.1:5000/source/pull](http://127.0.0.1:5000/source/pull)"  
headers =\> {  
Accept =\> "application/json"  
}  
}

```
"2" => {
		method => get
		url => "http://127.0.0.1:5000/source/commits"
		headers => {
			Accept => "application/json"
			   }
		}	
		
"3" => {
		method => get
		url => "http://127.0.0.1:5000/source/branchdata"
		headers => {
			Accept => "application/json"
			   }
		}	

	}
request_timeout => 180
socket_timeout => 180
schedule => { every => "40s" }
codec => "json"
}

```

}

output{  
stdout { codec =\> rubydebug }

```
if [urls] == ["1"]
{
	elasticsearch{
		hosts => ["localhost:9200"]
		index => "pull_test"
	}
}

if [urls] == ["2"]
{
	elasticsearch{
		hosts => ["localhost:9200"]
		index => "commit_test"
	}
}

if [urls] == ["3"]
{
	elasticsearch{
		hosts => ["localhost:9200"]
		index => "branch_test"
	}
}

```

}

---

<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 2, 2020, 6:33am UTC](https://discuss.elastic.co/t/separate-indexing-from-multiple-sources-in-one-logstash-file/222206/2 "2020-04-02T06:33:00Z")

</div>

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