I have created a docker image with ELK stack by using docker-compose. I have used filebeat to read log files, filebeat gives output to logstash and logstash gives outputs to elasticsearch and then finally elasticsearch gives data output to kibana dashboard. I write a yaml file called "filebeat.yml" and here is my filebeat.yml file.
filebeat.inputs:
- type: log
enabled: true
paths:
- /docker-containers/log/nginx/*.log
output.logstash:
hosts: ["localhost:5044"]
When the docker image is running followings are the terminal outputs.
OTP-Filebeat | 2019-01-09T08:15:00.099Z INFO instance/beat.go:400 filebeat start running.
OTP-Filebeat | 2019-01-09T08:15:00.100Z INFO registrar/registrar.go:134 Loading registrar data from /usr/share/filebeat/data/registry
OTP-Filebeat | 2019-01-09T08:15:00.100Z INFO registrar/registrar.go:141 States Loaded from registrar: 0
OTP-Filebeat | 2019-01-09T08:15:00.100Z INFO crawler/crawler.go:72 Loading Inputs: 0
OTP-Filebeat | 2019-01-09T08:15:00.101Z INFO log/input.go:138 Configured paths: [/mnt/log/*.log]
OTP-Filebeat | 2019-01-09T08:15:00.101Z INFO crawler/crawler.go:106 Loading and starting Inputs completed. Enabled inputs: 0
OTP-Filebeat | 2019-01-09T08:15:00.099Z INFO [monitoring] log/log.go:117 Starting metrics logging every 30s
OTP-Filebeat | 2019-01-09T08:15:00.101Z INFO cfgfile/reload.go:150 Config reloader started
OTP-Filebeat | 2019-01-09T08:15:00.101Z INFO cfgfile/reload.go:150 Config reloader started
OTP-Filebeat | 2019-01-09T08:15:00.101Z INFO cfgfile/reload.go:205 Loading of config files completed.
OTP-Filebeat | 2019-01-09T08:15:00.102Z INFO log/input.go:138 Configured paths: [/mnt/log/*.log]
OTP-Filebeat | 2019-01-09T08:15:00.102Z INFO input/input.go:114 Starting input of type: log; ID: 7490297193693978066
OTP-Filebeat | 2019-01-09T08:15:00.102Z INFO cfgfile/reload.go:205 Loading of config files completed.
The Configured paths seems like different and logs are not propagate to kibana.
additional infos:
- I have used 4 different containers to run filebeat, logstash, elasticsearch and kibana.
- I wrote one docker-compose file to configure all docker containers.
The docker-compose.yml file as follows.
version: '2'
services:
elasticsearch:
container_name: OTP-Elasticsearch
build:
context: ./elasticsearch
args:
- ELK_VERSION=${ELK_VERSION}
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
filebeat:
container_name: OTP-Filebeat
build:
context: ./filebeat
args:
- ELK_VERSION=${ELK_VERSION}
volumes:
- ./filebeat/config/filebeat.yml:/usr/share/filebeat/config/filebeat.yml:ro
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
depends_on:
- elasticsearch
logstash:
container_name: OTP-Logstash
build:
context: ./logstash
args:
- ELK_VERSION=${ELK_VERSION}
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro
ports:
- "5044:5044"
- "9600:9600"
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
links:
- elasticsearch
depends_on:
- filebeat
- elasticsearch
kibana:
container_name: OTP-Kibana
build:
context: ./kibana
args:
- ELK_VERSION=${ELK_VERSION}
volumes:
- ./kibana/config/:/usr/share/kibana/config:ro
ports:
- "5601:5601"
networks:
- elk
links:
- elasticsearch
depends_on:
- elasticsearch
- logstash
networks:
elk:
driver: bridge
I need to know how to configure log inputs to filebeat container correctly.
Thanks.