# How to get elastic logs in a binded docker volume?

**URL:** <https://discuss.elastic.co/t/how-to-get-elastic-logs-in-a-binded-docker-volume/193686>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [August 4, 2019, 2:45pm UTC](https://discuss.elastic.co/t/how-to-get-elastic-logs-in-a-binded-docker-volume/193686 "2019-08-04T14:45:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![key](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/key/32/45480_2.png) [@key](https://discuss.elastic.co/u/key)\
**Post date:** [August 4, 2019, 2:45pm UTC](https://discuss.elastic.co/t/how-to-get-elastic-logs-in-a-binded-docker-volume/193686/1 "2019-08-04T14:45:55Z")

</div>

I want to access the logs of elasticsearch while it's running in a docker container. The goal is to keep track of possible errors while indexing documents.  
I'm using the following docker-compose and I run it with _sudo docker-compose up_

```auto
version: '3.3'
services:
   
  elasticsearch1:
    restart: always
    image: elasticsearch:${ELK_VERSION}
    ports:
      - ${ES_PORT_HTTP}:9200
    volumes:
      - ./elasticsearch/data1:/usr/share/elasticsearch/data
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - ./elasticsearch/logs:/usr/share/elasticsearch/logs
    environment:
      - node.name=elasticsearch1
      - discovery.seed_hosts=elasticsearch2
      - cluster.initial_master_nodes=elasticsearch1, elasticsearch2
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS: -Xmx1g -Xms1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - ni-network

  elasticsearch2:
    restart: always
    image: elasticsearch:${ELK_VERSION}
    volumes:
      - ./elasticsearch/data2:/usr/share/elasticsearch/data
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    environment:
      - node.name=elasticsearch2
      - discovery.seed_hosts=elasticsearch1
      - cluster.initial_master_nodes=elasticsearch1, elasticsearch2
      - "ES_JAVA_OPTS: -Xmx1g -Xms1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - ni-network

networks:
  ni-network:
    external: true

```

Is it the right way to proceed ?  
I can't start this compose because of the following :

```auto
elasticsearch1_1_9fc8d5261881 | Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
elasticsearch1_1_9fc8d5261881 | output:
elasticsearch1_1_9fc8d5261881 | [0.000s][error][logging] Error opening log file 'logs/gc.log': Permission denied
elasticsearch1_1_9fc8d5261881 | [0.000s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=32,filesize=64m' failed.
elasticsearch1_1_9fc8d5261881 | error:
elasticsearch1_1_9fc8d5261881 | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
elasticsearch1_1_9fc8d5261881 | Invalid -Xlog option '-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.
elasticsearch1_1_9fc8d5261881 | Error: Could not create the Java Virtual Machine.
elasticsearch1_1_9fc8d5261881 | Error: A fatal exception has occurred. Program will exit.
elasticsearch1_1_9fc8d5261881 | at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:111)
elasticsearch1_1_9fc8d5261881 | at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:79)
elasticsearch1_1_9fc8d5261881 | at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:57)
elasticsearch1_1_9fc8d5261881 | at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:89)

```

---

<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 1, 2019, 2:45pm UTC](https://discuss.elastic.co/t/how-to-get-elastic-logs-in-a-binded-docker-volume/193686/2 "2019-09-01T14:45:55Z")

</div>

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