# Logstash stuck midway while processing while running from java

**URL:** <https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056>\
**Category:** Logstash\
**Created:** [March 15, 2018, 9:36am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056 "2018-03-15T09:36:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunilkumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunilkumar/32/28675_2.png) [@sunilkumar](https://discuss.elastic.co/u/sunilkumar)\
**Post date:** [March 15, 2018, 9:36am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056/1 "2018-03-15T09:36:04Z")

</div>

Logstash stuck at midway while processing a log file only while running from java(This issue doesn't occur when i run the same thing from logstash console)

This is my config file

input {  
file {  
path =\> "D:\logstash\logstash-6.1.0\bin\repoprolog.log"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
codec =\> multiline  
{  
pattern =\> "[%{DATA}"  
negate =\> true  
what =\> "previous"  
auto\_flush\_interval =\> 1  
}  
}   
}  
filter {  
grok {  
match =\> {"message" =\> "%{DATE}\_%{TIME} - %{POSINT:value} %{DATA:status} %{WORD:result} %{GREEDYDATA:final}"}  
}  
}  
output {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
}  
}  
log file contains only 1000 lines.Do i have to make any changes with jvm.options file?

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [March 17, 2018, 8:38am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056/2 "2018-03-17T08:38:03Z")

</div>

> [@sunilkumar](#):
>
> Logstash stuck at midway while processing a log file only while running from java(This issue doesn't occur when i run the same thing from logstash console)

What do you mean "running from Java" and "Logstash console"? Are these specific commands? Specific configurations? Modern releases of Logstash always runs in Java, regardless of how it is invoked.

Do the logs reveal anything interesting?  
Your grok pattern should probably be anchored (prefixed with `^`, with pattern capturing from beginning of each message), as unanchored patterns tend to do a lot more work than we intend them to do.

---

<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 14, 2018, 8:38am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056/3 "2018-04-14T08:38:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 25, 2018, 6:09am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056/4 "2018-04-25T06:09:12Z")

</div>

Answering this old thread as I met @sunilkumar at a conference.

My advice is to use instead Ingest Node and the [Grok processor](https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html) instead of trying to start Logstash "embedded" from a Java application.

Also starting Logstash as a service with a pipeline defined in elasticsearch itself might be another solution. So you can just update the pipeline in Elasticsearch using either the API or using Kibana pipeline management feature (available in X-Pack basic).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 25, 2018, 6:09am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056/5 "2018-04-25T06:09:29Z")

</div>



---

<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:** [November 4, 2022, 5:17am UTC](https://discuss.elastic.co/t/logstash-stuck-midway-while-processing-while-running-from-java/124056/6 "2022-11-04T05:17:11Z")

</div>


