# Logstash's OutOfMemoryError

**URL:** <https://discuss.elastic.co/t/logstashs-outofmemoryerror/45319>\
**Category:** Logstash\
**Created:** [March 24, 2016, 9:23am UTC](https://discuss.elastic.co/t/logstashs-outofmemoryerror/45319 "2016-03-24T09:23:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lester015](https://avatars.discourse-cdn.com/v4/letter/l/cc9497/32.png) [@lester015](https://discuss.elastic.co/u/lester015)\
**Post date:** [March 24, 2016, 9:23am UTC](https://discuss.elastic.co/t/logstashs-outofmemoryerror/45319/1 "2016-03-24T09:23:51Z")

</div>

hi everyone,  
after I execute logstash orders the console show error as bellows:

""Ruby-0-Thread-6: /usr/pds/logstash-2.2.2/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.5.1-java/lib/logstash/outputs/elasticsearch/buffer.rb:78" java.lang.OutOfMemoryError: Java heap space  
Exception in pipelineworker, the pipeline stopped processing new events, please check your filter configuration and restart Logstash. {"exception"=\>java.lang.OutOfMemoryError: Java heap space, "backtrace"=\>[], :level=\>:error}  
Error: Your application used more memory than the safety cap of 1G.  
Specify -J-Xmx####m to increase it (#### = cap size in MB).  
Specify -w for full OutOfMemoryError stack trace"

I using the logstash jdbc input conf as bellows:  
input {  
jdbc {  
jdbc\_driver\_library =\> "/opt/pds/lib/postgresql-9.3-1101-jdbc41.jar"  
jdbc\_driver\_class =\> "org.postgresql.Driver"  
jdbc\_connection\_string =\> "jdbc:postgresql://10.2.5.116:5432/postgres"  
jdbc\_user =\> "postgres"  
jdbc\_password =\> "postgres"  
jdbc\_fetch\_size =\> 10000  
statement =\> "SELECT \* from postgres\_log"  
}  
}  
output{  
stdout { codec =\> rubydebug }  
elasticsearch {  
document\_id =\> "%{session\_line\_num}"  
hosts =\> ["127.0.0.1"]  
index =\> "postgres\_log"  
}

}  
when I add the limit 1000000 of the statement,it's runing ok!BTW,the table has count is 3561859.

Best Regards,  
Levi

---

<div class="post-metadata">

**Author:** ![lester015](https://avatars.discourse-cdn.com/v4/letter/l/cc9497/32.png) [@lester015](https://discuss.elastic.co/u/lester015)\
**Post date:** [March 29, 2016, 3:07am UTC](https://discuss.elastic.co/t/logstashs-outofmemoryerror/45319/2 "2016-03-29T03:07:03Z")

</div>

How can I solve above the problem? thanks!

---

<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:** [July 6, 2017, 5:05am UTC](https://discuss.elastic.co/t/logstashs-outofmemoryerror/45319/3 "2017-07-06T05:05:04Z")

</div>


