title: Cannot show any logs in Kibana when I work with Docker in my Spring Boot App
body: <p>In my spring boot app with ELK, I've implemented CRUD operations with mysql.
  I can add logs in the file when I work with localhost.</p>
  <p>My issue is that I cannot add logs in that file when I work with Docker.</p>
  <p>I think there is a configuration issue in logstash, filebeat but I couldn't find where is the issue.</p>
  <p>How can I add logs in the logs file and show them in Kibana?</p>
  <p>Here is my <strong>docker-compose.yml</strong></p>
  <pre><code>version: '3.8'
  services:
    logstash:
      image: docker.elastic.co/logstash/logstash:7.15.2
      user: root
      command: -f /etc/logstash/conf.d/
      volumes:
        - ./elk/logstash/:/etc/logstash/conf.d/
        - ./Springboot-Elk.log:/tmp/logs/Springboot-Elk.log
      ports:
        - &quot;5044:5044&quot;
      environment:
        LS_JAVA_OPTS: &quot;-Xmx256m -Xms256m&quot;
      depends_on:
        - elasticsearch
      networks:
        - elk
  
    filebeat:
      build:
        context: ./filebeat
        dockerfile: Dockerfile
      links:
        - &quot;logstash:logstash&quot;
      volumes:
        - /var/run/docker.sock:/host_docker/docker.sock
        - /var/lib/docker:/host_docker/var/lib/docker
      depends_on:
        - logstash
  
    kibana:
      image: docker.elastic.co/kibana/kibana:7.15.2
      user: root
      volumes:
        - ./elk/kibana/:/usr/share/kibana/config/
      ports:
        - &quot;5601:5601&quot;
      depends_on:
        - elasticsearch
      entrypoint: [&quot;./bin/kibana&quot;, &quot;--allow-root&quot;]
      networks:
        - elk
  
    elasticsearch:
      image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
      user: root
      volumes:
        - ./elk/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      ports:
        - &quot;9200:9200&quot;
        - &quot;9300:9300&quot;
      environment:
        ES_JAVA_OPTS: &quot;-Xmx256m -Xms256m&quot;
      networks:
        - elk
  
    app:
      image: 'springbootelk:latest'
      build:
        context: .
        dockerfile: Dockerfile
      container_name: SpringBootElk
      depends_on:
        - db
        - logstash
        - kibana
        - elasticsearch
      ports:
        - '8077:8077'
      environment:
        - SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/springbootexample?useSSL=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=Turkey
        - SPRING_DATASOURCE_USERNAME=springexample
        - SPRING_DATASOURCE_PASSWORD=111111
        - SPRING_JPA_HIBERNATE_DDL_AUTO=update
    db:
      container_name: db
      image: 'mysql:latest'
      ports:
        - &quot;3366:3306&quot;
      restart: always
      environment:
        MYSQL_DATABASE: ${MYSQL_DATABASE}
        MYSQL_USER: ${MYSQL_USER}
        MYSQL_PASSWORD: ${MYSQL_PASSWORD}
        MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      volumes:
        - db-data:/var/lib/mysql
  
  # Volumes
  volumes:
    db-data:
  
  networks:
    elk:
  </code></pre>
  <p><strong>filebeat.yml</strong></p>
  <pre><code>filebeat.inputs:
    - type: docker
      enabled: true
      containers:
        ids:
          - &quot;*&quot;
  
  processors:
    - add_docker_metadata:
        host: &quot;unix:///var/run/docker.sock&quot;
  
  filebeat.config.modules:
    path: ${path.config}/modules.d/*.yml
    reload.enabled: false
  
  output.logstash:
    hosts: [&quot;logstash:5044&quot;]
  
  log files:
  logging.level: info
  logging.to_files: false
  logging.to_syslog: false
  loggins.metrice.enabled: false
  logging.files:
    path: /var/log/filebeat
    name: filebeat
    keepfiles: 7
    permissions: 0644
  ssl.verification_mode: none
  </code></pre>
  <p><strong>Dockerfile</strong> in <strong>filebeat</strong></p>
  <pre><code>FROM docker.elastic.co/beats/filebeat:7.15.2
  
  COPY filebeat.yml /usr/share/filebeat/filebeat.yml
  
  USER root
  RUN mkdir /usr/share/filebeat/dockerlogs
  RUN chown -R root /usr/share/filebeat/
  RUN chmod -R go-w /usr/share/filebeat/
  </code></pre>
  <p><strong>logstash.conf</strong></p>
  <pre><code>input {
          beats {
                  port =&gt; 5044
          }
          file {
                  path =&gt; &quot;/tmp/logs/Springboot-Elk.log&quot;
                  sincedb_path =&gt; &quot;/dev/null&quot;
                  start_position =&gt; &quot;beginning&quot;
          }
  }
  output {
          stdout{
                  codec =&gt; rubydebug
          }
          elasticsearch {
                  hosts =&gt; &quot;elasticsearch:9200&quot;
                  index =&gt; &quot;dockerlogs&quot;
          }
  }
  </code></pre>
  <p>Project Link : <a href="https://github.com/Rapter1990/SpringBootElk" rel="nofollow noreferrer">Link</a></p>