Iam using docker-elk in github and running the docker-elk container.my logs are showing in kibana. Now i want to use file beat instead of logstash-forwarder in docker-elk.for that i selected elastic/beats in github and built a docker image.Now this is included in my docker-compose.yml.now when iam running the container logstash running,elastic search running but file beat exited with code 0.
This is my docker-compose.yml
elasticsearch:
image: elasticsearch:latest
command: elasticsearch -Des.network.host=0.0.0.0
ports:
- "9200:9200"
logstash:
image: logstash:2.0
command: logstash agent --config /etc/logstash/conf.d/ -l /var/log/logstash/logstash.log --debug
volumes:
- ./logstash/config:/etc/logstash/conf.d
- ./logstash/patterns/nginx:/etc/logstash/patterns/nginx
ports:
- "5000:5000"
links:
- elasticsearch
kibana:
build: kibana/
volumes:
- ./kibana/config/kibana.yml:/opt/kibana/config/kibana.yml
ports:
- "5601:5601"
links:
- elasticsearch
beats:
image: pavankuamr/beats
volumes:
- ./logstash/beats:/etc/filebeat
- /var/log/nginx:/var/log/nginx
links:
- logstash
- elasticsearch
environment:
- ES_HOST=elasticsearch
- LS_HOST=logstash
- LS_TCP_PORT=5044
This is my filebeat.yml
filebeat:
prospectors:
paths:
- /var/log/nginx/access.log
input_type: log
registry_file: /var/lib/filebeat/registry
config_dir: /etc/filebeat/conf.d
elasticsearch:
enabled: false
hosts: ["localhost:9200"]
logstash:
# The Logstash hosts
enabled: true
hosts: ["localhost:5044"]
This is my logstash.conf
input {
beats {
port => 5044
type => "logs"
}
file {
type => "nginx"
start_position => "beginning"
path => [ "/var/log/nginx/access.log" ]
}
file {
type => "nginxerror"
start_position => "beginning"
path => [ "/var/log/nginx/error.log" ]
}
}
filter {
if [type] == "nginx" {
grok {
patterns_dir => "/etc/logstash/patterns"
match => { "message" => "%{NGINX_ACCESS}" }
remove_tag => ["_grokparsefailure"]
add_tag => ["nginx_access"]
}
geoip {
source => "remote_addr"
}
}
if [type] == "nginxerror" {
grok {
patterns_dir => "/etc/logstash/patterns"
match => { "message" => "%{NGINX_ERROR}" }
remove_tag => ["_grokparsefailure"]
add_tag => ["nginx_error"]
}
}
}
output {
elasticsearch {
hosts => "elasticsearch:9200"
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
}
Change hosts: ["localhost:9200"]
for hosts: ["logstash:9200"]
into logstash output on filebeat.yml