# Log rotation elasticsearch problem

**URL:** <https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826>\
**Category:** Elasticsearch\
**Created:** [April 10, 2017, 1:32pm UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826 "2017-04-10T13:32:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![breezzz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/breezzz/32/18245_2.png) [@breezzz](https://discuss.elastic.co/u/breezzz)\
**Post date:** [April 10, 2017, 1:32pm UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/1 "2017-04-10T13:32:40Z")

</div>

Good day!  
I have problem with tuning log4j2.properties with manual [Configuring Elasticsearch | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html)

after add this code

> appender.rolling.strategy.type = DefaultRolloverStrategy  
> appender.rolling.strategy.action.type = Delete  
> appender.rolling.strategy.action.basepath = ${sys:es.logs.base\_path}  
> appender.rolling.strategy.action.condition.type = IfLastModified  
> appender.rolling.strategy.action.condition.age = 7D  
> appender.rolling.strategy.action.PathConditions.type = IfFileName  
> appender.rolling.strategy.action.PathConditions.glob = ${sys:es.logs.cluster\_name}-\*

i get errors in log

> апр 10 13:26:29 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14253]: 2017-04-10 13:26:29,247 main ERROR Unable to locate plugin type for DefaultRolloverStrategy  
> апр 10 13:26:29 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14253]: 2017-04-10 13:26:29,362 main ERROR Unable to locate plugin for IfLastModified  
> апр 10 13:26:29 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14253]: 2017-04-10 13:26:29,362 main ERROR Unable to locate plugin for IfFileName  
> апр 10 13:26:29 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14253]: 2017-04-10 13:26:29,363 main ERROR Unable to locate plugin for Delete  
> апр 10 13:26:29 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14253]: 2017-04-10 13:26:29,363 main ERROR Unable to locate plugin for DefaultRolloverStrategy  
> апр 10 13:26:29 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14253]: 2017-04-10 13:26:29,367 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.RollingFileAppender, element RollingFile. java.lang.NullPointerException

one string

> appender.rolling.strategy.type = DefaultRolloverStrategy

doing error message as

> апр 10 13:31:01 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14345]: 2017-04-10 13:31:01,106 main ERROR Unable to locate plugin type for DefaultRolloverStrategy  
> апр 10 13:31:01 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14345]: 2017-04-10 13:31:01,201 main ERROR Unable to locate plugin for DefaultRolloverStrategy  
> апр 10 13:31:01 [default-centos-72.vagrantup.com](http://default-centos-72.vagrantup.com) elasticsearch[14345]: 2017-04-10 13:31:01,204 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.RollingFileAppender, element RollingFile. java.lang.NullPointerException

Help me, please

---

<div class="post-metadata">

**Author:** ![breezzz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/breezzz/32/18245_2.png) [@breezzz](https://discuss.elastic.co/u/breezzz)\
**Post date:** [April 10, 2017, 2:59pm UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/2 "2017-04-10T14:59:29Z")

</div>

elasticsearch.noarch 5.3.0-1

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 11, 2017, 1:35am UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/3 "2017-04-11T01:35:45Z")

</div>

I think that you copied and pasted these lines directly from the docs and ended up with spaces at the end of each line (and I see spaces at the end of each of your lines here). This confuses Log4j. Remove these extraneous spaces and you should be fine.

---

<div class="post-metadata">

**Author:** ![breezzz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/breezzz/32/18245_2.png) [@breezzz](https://discuss.elastic.co/u/breezzz)\
**Post date:** [April 11, 2017, 10:48am UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/4 "2017-04-11T10:48:48Z")

</div>

I am confused ☹  
It is really spaces ☹

@jasontedor Thank you!

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 11, 2017, 11:17am UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/5 "2017-04-11T11:17:57Z")

</div>

You're welcome. 😉

---

<div class="post-metadata">

**Author:** ![ol3k](https://avatars.discourse-cdn.com/v4/letter/o/919ad9/32.png) [@ol3k](https://discuss.elastic.co/u/ol3k)\
**Post date:** [April 19, 2017, 7:40pm UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/6 "2017-04-19T19:40:36Z")

</div>

A hint "Look for spaces at the end of each line when copying from this site" would have saved me some hours from testing too.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 19, 2017, 9:18pm UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/7 "2017-04-19T21:18:29Z")

</div>

I opened [https://github.com/elastic/elasticsearch/pull/24198](https://github.com/elastic/elasticsearch/pull/24198).

---

<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:** [May 17, 2017, 9:24pm UTC](https://discuss.elastic.co/t/log-rotation-elasticsearch-problem/81826/8 "2017-05-17T21:24:48Z")

</div>

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