# Logstash high memroy consumption and possibly a leak

**URL:** <https://discuss.elastic.co/t/logstash-high-memroy-consumption-and-possibly-a-leak/161598>\
**Category:** Logstash\
**Created:** [December 19, 2018, 9:55pm UTC](https://discuss.elastic.co/t/logstash-high-memroy-consumption-and-possibly-a-leak/161598 "2018-12-19T21:55:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ray20](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@ray20](https://discuss.elastic.co/u/ray20)\
**Post date:** [December 19, 2018, 9:55pm UTC](https://discuss.elastic.co/t/logstash-high-memroy-consumption-and-possibly-a-leak/161598/1 "2018-12-19T21:55:52Z")

</div>

We run logstash 6.3.1 with a single pipeline of beats input plugin, json and grok filters, and S3 output plugin. It runs in Docker and is configured with 2GB for Xms and Xmx. The node itself has 4GB total memory. When it starts everything looks good but as time passes, it starts taking more and more memory as much as available on the node. Right now its java process has taken 3.8GB.

Using logstash health api (logstash:9600/\_node/stats/jvm) shows heap usage of about 50-60% but we don't get any info on non-heap parts, So, it doesn't seem to be an issue with java heap at this point.

How can we get more info on non-heap memory (java metaspace) when it runs in a container?  
Could we limit jvm metasapce by adding **-XX:MaxMetaspaceSize** to jvm.options file?  
What else can we look at or tune?

Thanks,

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 24, 2018, 3:24am UTC](https://discuss.elastic.co/t/logstash-high-memroy-consumption-and-possibly-a-leak/161598/2 "2018-12-24T03:24:46Z")

</div>

Java cannot use more than whatever you define as heap. What you are likely seeing is off heap memory, controlled by the OS.

---

<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:** [January 21, 2019, 3:25am UTC](https://discuss.elastic.co/t/logstash-high-memroy-consumption-and-possibly-a-leak/161598/3 "2019-01-21T03:25:03Z")

</div>

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