I created an elk folder in my local machine which contains a docker-compose.yml file, logstash config file, and log file to read the logs from. I made the necessary changes in a spring boot app application.yaml file to log all the logs in my log file in the elk folder. I executed the docker-compose file, which created three containers for elastic search, logstash and kibana. I can get a success message on logstash logs, which means logstash is working correctly. I can open the kibana console and create an index pattern. I am not able to see the logs getting reflected in kibana discover. Followed all the steps on a Virtual Machine but faced the same issue.
version: '3.6'
services:
elasticsearch:
image: elasticsearch:7.16.2
container_name: elasticsearch
restart: always
volumes:
- elastic_data:/usr/share/elasticsearch/data/
environment:
- ES_JAVA_OPTS=-Xmx256m -Xms256m
- discovery.type=single-node
ports:
- '9200:9200'
- '9300:9300'
networks:
- elk
logstash:
image: logstash:7.16.2
container_name: logstash
restart: always
volumes:
- /elk/logstash/:/usr/share/logstash/pipeline
command: logstash -f /usr/share/logstash/pipeline/logstash.conf
depends_on:
- elasticsearch
ports:
- '9600:9600'
environment:
networks:
- elk
kibana:
image: kibana:7.16.2
container_name: kibana
restart: always
ports:
- '5601:5601'
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
depends_on:
- elasticsearch
networks:
- elk
volumes:
elastic_data: {}
networks:
elk:
input{
file {
path => "/temp/inlog.log"
}
}
output {
elasticsearch {
hosts => ["http://elasticsearch:9200"]
}
}