# How to set volume map for logstash.conf file in docker compose file

**URL:** https://discuss.elastic.co/t/how-to-set-volume-map-for-logstash-conf-file-in-docker-compose-file/350422
**Category:** Logstash
**Tags:** docker
**Created:** [January 5, 2024, 3:20am UTC](https://discuss.elastic.co/t/how-to-set-volume-map-for-logstash-conf-file-in-docker-compose-file/350422 "2024-01-05T03:20:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sunny84](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Sunny84](https://discuss.elastic.co/u/Sunny84)
#### Post date: [January 5, 2024, 3:20am UTC](https://discuss.elastic.co/t/how-to-set-volume-map-for-logstash-conf-file-in-docker-compose-file/350422/1 "2024-01-05T03:20:26Z")

</div>

Hello, I am trying to setup a docker compose file for setting up ELK stack to be able to use logging on local machine.

Below is the error shown in the terminal window, my stack is windows 11 home, Docker Engine v24.0.7, PowerShell v7.4.0  
Can anyone guide on how to map volume so as to override default logstash.conf?  
Let me know if you need further info regarding this query.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/0/006df25dcd7ddd2e1050c4a49844d335ee28bf69.png)

I am using below docker compose file

```auto
services:
  elasticsearch:
   container_name: elasticsearch
   image: docker.elastic.co/elasticsearch/elasticsearch:8.11.3
   ports:
    - 9200:9200
   environment:
    - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    - discovery.type=single-node
  kibana:
   container_name: kibana
   image: docker.elastic.co/kibana/kibana:8.11.3
   ports:
    - 5601:5601
   depends_on:
    - elasticsearch
   environment:
    - ELASTICSEARCH_URL=http://localhost:9200
  logstash:
    container_name: logstash
    image: docker.elastic.co/logstash/logstash:8.11.3
    depends_on:
      - elasticsearch
    volumes:
      - C:/D/Log/ELK/logstash.conf=/usr/share/logstash/pipeline/logstash.conf

```

Below is my logstash.conf file

```auto
input
{
    http {
        #default host 0.0.0.0:8080
        codec => json
    }
}
output {
    stdout { }
    elasticsearch {
        hosts => ["http://elastic:9200"]
    }
}

```

---

<div class="post-metadata">

### Author: ![Sunny84](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Sunny84](https://discuss.elastic.co/u/Sunny84)
#### Post date: [January 5, 2024, 8:46am UTC](https://discuss.elastic.co/t/how-to-set-volume-map-for-logstash-conf-file-in-docker-compose-file/350422/2 "2024-01-05T08:46:06Z")

</div>

In case anyone else comes across this issue then the solution is to use below section for volumes in the compose.yml file.

**Note:** local machine path is relative to where the `docker compose up -d` command is run from.  
In my case, I was running the command from `C:/D/Log/ELK` folder in PowerShell. Therefore, replaced that part with `./`  
Also, for mapping to work we need to use `:` instead of `=`

```auto
volumes:
      - ./logstash.conf:/usr/share/logstash/pipeline/logstash.conf

```

---

<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: [February 2, 2024, 8:46am UTC](https://discuss.elastic.co/t/how-to-set-volume-map-for-logstash-conf-file-in-docker-compose-file/350422/3 "2024-02-02T08:46:35Z")

</div>

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