Cannot connect logstash in filebeat in my Spring Boot ELK

I've tried to implement a Spring Boot Elk running with Docker.
The reason I've tried is to check logs in Kibana but I have a problem which I couldn't fix it.
I cannot see any logs when I work with Docker.
I think there is a problem in Logatash and Filebeat.
How can I fix it?

Here is my logstash.conf

input {
        beats {
                port => 5000
        }
        file {
                path => "/tmp/logs/Springboot-Elk.log"
                sincedb_path => "/dev/null"
                start_position => "beginning"
        }
}
output {
        stdout{
                codec => rubydebug
        }
        elasticsearch {
                hosts => "elasticsearch:9200"
                index => "dockerlogs"
        }
}

filebeat Dockerfile

FROM docker.elastic.co/beats/filebeat:7.15.2

COPY /filebeat/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/

filebeat.yml

filebeat.inputs:
  - type: docker
    enabled: true
    containers:
      ids:
        - "*"


processors:
  - add_docker_metadata:
      host: "unix:///var/run/docker.sock"

filebeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false

output.logstash:
  hosts: ["logstash:5000"]

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

docker-compose.yml

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:
      - "5000:5000"
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    depends_on:
      - elasticsearch

  filebeat:
    image: docker.elastic.co/beats/filebeat:7.15.2
    build:
      context: ./filebeat
      dockerfile: Dockerfile
    links:
      - "logstash:logstash"
    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:
      - "5601:5601"
    depends_on:
      - elasticsearch
    entrypoint: ["./bin/kibana", "--allow-root"]

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.15.2
    user: root
    volumes:
      - ./elk/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
  app:
    image: 'springbootelk:latest'
    build:
      context: .
      dockerfile: Dockerfile
    container_name: SpringBootElk
    depends_on:
      - db
      - logstash
    ports:
      - '8077:8077'
    environment:
      - SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/springbootexample?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey
      - SPRING_DATASOURCE_USERNAME=springexample
      - SPRING_DATASOURCE_PASSWORD=111111
      - SPRING_JPA_HIBERNATE_DDL_AUTO=update
  db:
    container_name: db
    image: 'mysql:latest'
    ports:
      - "3366:3306"
    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:

Here is my project link : My Project

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