# Logstash with java

**URL:** <https://discuss.elastic.co/t/logstash-with-java/98213>\
**Category:** Logstash\
**Created:** [August 24, 2017, 11:00am UTC](https://discuss.elastic.co/t/logstash-with-java/98213 "2017-08-24T11:00:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lbr1](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lbr1](https://discuss.elastic.co/u/Lbr1)\
**Post date:** [August 24, 2017, 11:00am UTC](https://discuss.elastic.co/t/logstash-with-java/98213/1 "2017-08-24T11:00:42Z")

</div>

Hello, I would like to ask two questions regarding logstash.

I'm developing a project to parse text, and I'm also using Logstash and elasticSearch.

My questions are:  
1- Is it possible to use Logstash from the java application?

2- If so, is it possible to do several searches at the same time? The idea is not to use several keywords, but to do a search and if you want in 1 minute to start another different. Is this possible?

greetings

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 24, 2017, 8:07pm UTC](https://discuss.elastic.co/t/logstash-with-java/98213/2 "2017-08-24T20:07:45Z")

</div>

Since Logstash doesn't do searches it's not clear what you mean. Are you perhaps actually asking about Elasticsearch?

---

<div class="post-metadata">

**Author:** ![Lbr1](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lbr1](https://discuss.elastic.co/u/Lbr1)\
**Post date:** [August 24, 2017, 9:29pm UTC](https://discuss.elastic.co/t/logstash-with-java/98213/3 "2017-08-24T21:29:15Z")

</div>

I apologize. I start elasticSearch and use the following configuration in logstash:

```
consumer_key => "..."
    consumer_secret => "...."
    oauth_token => "....."
    oauth_token_secret => "....."
	keywords => ["real madrid"]
	full_tweet => true
	#type => hashtag
	#languages => "PT"
	#locations =>
	ignore_retweets => true
}
}
filter {
 
}
output {
	stdout { codec => dots }
	#stdout { codec => rubydebug }
	#stdout { codec => json }
	elasticsearch {
		hosts => "localhost:9200"
		index => "super"
		document_type => "tweet"
		template => "twitter_template.json"
		template_name => "twitter"
  }

```

My question is if I can start this process through Java and if I can post several processes of this search (different searches), at different times, but may be running at the same time.

Could I explain myself better, or not at all?

greetings

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 25, 2017, 5:07am UTC](https://discuss.elastic.co/t/logstash-with-java/98213/4 "2017-08-25T05:07:47Z")

</div>

> My question is if I can start this process through Java

Java does of course support starting other programs, so yes.

> if I can post several processes of this search (different searches), at different times, but may be running at the same time.

Is it the twitter input you're calling a search? But yes, you can run more than one Logstash instance concurrently.

---

<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:** [September 22, 2017, 5:08am UTC](https://discuss.elastic.co/t/logstash-with-java/98213/5 "2017-09-22T05:08:32Z")

</div>

Closed on September 22, 2017, 5:08am UTC

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