# Logstash template file does not exist or cannot be opened

**URL:** <https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829>\
**Category:** Logstash\
**Created:** [August 24, 2016, 2:15pm UTC](https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829 "2016-08-24T14:15:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![daiyue](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@daiyue](https://discuss.elastic.co/u/daiyue)\
**Post date:** [August 24, 2016, 2:15pm UTC](https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829/1 "2016-08-24T14:15:00Z")

</div>

Hi, I set up a template file in `logstash.conf` `output` like this,

```
output {
   elasticsearch {
     hosts => ["172.17.0.2:9200"]
     manage_template => false
     template => "/home/user_name/docker-elk/logstash/core_mapping_template.json"
     template_overwrite => true
     index => "%{host}-%{[@metadata][log_type]}-%{+YYYY.MM.dd}"
     document_type => "%{[@metadata][log_type]}"
   }
   stdout { codec => json }
}

```

the `template.json` is in the directory specified above, and `logstash` generated the following error,

```
logstash_1 | {:timestamp=>"2016-08-24T13:12:27.260000+0000", :message=>"Invalid setting for elasticsearch output plugin:\n\n output {\n elasticsearch {\n # This setting must be a path\n # File does not exist or cannot be opened /home/user_name/docker-elk/logstash/core_mapping_template.json\n template => \"/home/user_name/docker-elk/logstash/core_mapping_template.json\"\n ...\n }\n }", :level=>:error}

```

I have `chmod` the `json` file to `755`.

I am running `ELK` using `docker 1.11.2`.

How to fix the issue?

cheers

---

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 24, 2016, 2:33pm UTC](https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829/2 "2016-08-24T14:33:17Z")

</div>

> [@daiyue](#):
>
> manage\_template =\> false

If you are calling dynamic template from a file location, it should be set to true

---

<div class="post-metadata">

**Author:** ![daiyue](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@daiyue](https://discuss.elastic.co/u/daiyue)\
**Post date:** [August 24, 2016, 2:48pm UTC](https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829/3 "2016-08-24T14:48:15Z")

</div>

Hi, changed `manage_template => true`, the error persists.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 24, 2016, 8:14pm UTC](https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829/4 "2016-08-24T20:14:40Z")

</div>

So you're running Logstash in a Docker container? Is /home/user\_name/docker-elk/logstash/core\_mapping\_template.json accessible inside that Docker container?

> I have chmod the json file to 755.

A JSON file isn't executable so don't set the executable bit. Also, making sure the permissions of the file itself are relaxed isn't enough. All directories leading up to the file must grant executable permissions to the user that Logstash runs as.

---

<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, 4:41am UTC](https://discuss.elastic.co/t/logstash-template-file-does-not-exist-or-cannot-be-opened/58829/5 "2017-07-06T04:41:45Z")

</div>


