# Will elasticsearch create logs directory if not exist?

**URL:** <https://discuss.elastic.co/t/will-elasticsearch-create-logs-directory-if-not-exist/245003>\
**Category:** Elasticsearch\
**Created:** [August 14, 2020, 11:37am UTC](https://discuss.elastic.co/t/will-elasticsearch-create-logs-directory-if-not-exist/245003 "2020-08-14T11:37:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAM\_NATHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_nathan/32/50393_2.png) [@RAM\_NATHAN](https://discuss.elastic.co/u/RAM_NATHAN)\
**Post date:** [August 14, 2020, 11:37am UTC](https://discuss.elastic.co/t/will-elasticsearch-create-logs-directory-if-not-exist/245003/1 "2020-08-14T11:37:25Z")

</div>

Hi

Will elasticsearch create logs directory I have given in path.logs, if not exist?  
It seems like service not starting up if log directory is not there.  
Is there anyway I can tell elasticsearch to create the directory if not exist

---

<div class="post-metadata">

**Author:** ![Steve\_Mushero](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steve_mushero/32/22441_2.png) [@Steve\_Mushero](https://discuss.elastic.co/u/Steve_Mushero)\
**Post date:** [August 15, 2020, 2:25am UTC](https://discuss.elastic.co/t/will-elasticsearch-create-logs-directory-if-not-exist/245003/2 "2020-08-15T02:25:38Z")

</div>

How are you installing it as I think the RPM at least does that, plus sets ownership, etc. It's not just about creating, but also ownership/rights - for example, you often can't just randomly create directories in /var/log as a non-root user.

---

<div class="post-metadata">

**Author:** ![Charele](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@Charele](https://discuss.elastic.co/u/Charele)\
**Post date:** [August 15, 2020, 4:14am UTC](https://discuss.elastic.co/t/will-elasticsearch-create-logs-directory-if-not-exist/245003/3 "2020-08-15T04:14:38Z")

</div>

I think you must pre-create the logs folder,  
because the Elasticsearch boot script need it

java Elasticsearch  
...  
-XX:ErrorFile=logs/hs\_err\_pid%p.log  
-Xlog:gc\*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m  
...

It will throw exception if it does not exist.

note, the boot scrpt don't need the "path.data", so the ES process will create the folder if can't find it.

---

<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 12, 2020, 4:14am UTC](https://discuss.elastic.co/t/will-elasticsearch-create-logs-directory-if-not-exist/245003/4 "2020-09-12T04:14:46Z")

</div>

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