# Create Logstash output files in a docker image

**URL:** <https://discuss.elastic.co/t/create-logstash-output-files-in-a-docker-image/204195>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [October 18, 2019, 9:39am UTC](https://discuss.elastic.co/t/create-logstash-output-files-in-a-docker-image/204195 "2019-10-18T09:39:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![basavyr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basavyr/32/55663_2.png) [@basavyr](https://discuss.elastic.co/u/basavyr)\
**Post date:** [October 18, 2019, 9:39am UTC](https://discuss.elastic.co/t/create-logstash-output-files-in-a-docker-image/204195/1 "2019-10-18T09:39:34Z")

</div>

I'm trying to integrate my Logstash development project with Docker (I am quite new to Docker as well, so my knowledge of Docker is quite basic).  
I am able to create an image with a simple Dockerfile and then successfully run the image with a basic logstash config file, however, I actually want my config file to do more than just `stdout {}` in console view. More exactly, I want to save the output of some filtered logs (with grok) in a JSON file, in a certain folder in that image. For this I added some code in the Dockerfile, but when I run the image, whenever it tries to execute the commands in the logstash config file I see this error, and then the JVM stops.

```auto
[2019-10-18T09:33:56,898][INFO][logstash.outputs.file] Opening file {:path=>"/usr/share/logstash/data/logstashOUTPUT.json"}
[2019-10-18T09:33:56,906][ERROR][org.logstash.execution.WorkerLoop] Exception in pipelineworker, the pipeline stopped processing new events, please check your filter configuration and restart Logstash.
org.jruby.exceptions.SystemCallError: (EACCES) Permission denied - /usr/share/logstash/data/logstashOUTPUT.json

```

I assume that my Docker `ADD` is adding the file where I need, but when the `output` command from the logstash .conf file tries to write in the JSON file, the permission is not granted.  
How can I fix this ?

Here is the content of my Docker file as well:

```auto
FROM docker.elastic.co/logstash/logstash:7.4.0
RUN rm -f /usr/share/logstash/pipeline/logstash.conf
#ADD pipelines.yml /usr/share/logstash/pipeline/
ADD logstashDocker.conf /usr/share/logstash/pipeline/
ADD logstashOUTPUT.json /usr/share/logstash/data/

```

---

<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:** [November 15, 2019, 9:39am UTC](https://discuss.elastic.co/t/create-logstash-output-files-in-a-docker-image/204195/2 "2019-11-15T09:39:36Z")

</div>

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