As part of my lab exercise to learn the docker log parsing. I am creating simple pipeline in which beat will send the data to logstash and further logstash will index this data in ES by creating new index.
root@elk-machine1:~/BELK# cat beat/filebeat.yml
filebeat.prospectors:
- type: log
paths:
- '/var/lib/docker/containers/*/*.log'
json.message_key: log
json.keys_under_root: true
#processors:
#- add_docker_metadata: ~
output.elasticsearch:
hosts: ["logstash1:9200"]
root@elk-machine1:~/BELK# cat logstash/pipeline/logstash-docker.conf
input {
beats {
port => 5044
codec => json_lines
}
}
filter {
}
output {
elasticsearch {
hosts => ["http://elasticsearch1:9200"]
index => "docker-logs"
}
}
I have used these commands for starting the containers.
$ docker run -d --rm --name elasticsearch1 --hostname=elasticsearch1 --network=elk -p 9200:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.4
$ docker run -d --rm --name logstash1 --hostname=logstash1 --network=elk -v ~/BELK/logstash/pipeline/:/usr/share/logstash/pipeline/ docker.elastic.co/logstash/logstash:6.2.4
$ docker run -d --rm --name filebeat1 --hostname=filebeat1 --network=elk -v ~/BELK/beat/filebeat.yml:/usr/share/filebeat/filebeat.yml docker.elastic.co/beats/filebeat:6.2.4
I am not able to see any new index being getting created in ES after running the containers. Following are the containers which I started to generate some log files in /var/lib/docker/containers/ directory. I have created some containers even after starting the whole pipeline to see whether "beginning" logstash issue is happening here but no luck.
root@elk-machine1:~/BELK# docker ps -a | grep graphite
c8a7466c5abb hopsoft/graphite-statsd "/sbin/my_init" 23 minutes ago Up 23 minutes 80/tcp, 2003-2004/tcp, 2023-2024/tcp, 8125-8126/tcp, 8125/udp graphite4
ed398e7f895c hopsoft/graphite-statsd "/sbin/my_init" 35 minutes ago Up 35 minutes 80/tcp, 2003-2004/tcp, 2023-2024/tcp, 8125-8126/tcp, 8125/udp graphite3
2b9676a1cb97 hopsoft/graphite-statsd "/sbin/my_init" About an hour ago Up About an hour 80/tcp, 2003-2004/tcp, 2023-2024/tcp, 8125-8126/tcp, 8125/udp graphite2
8251763d3082 hopsoft/graphite-statsd "/sbin/my_init" About an hour ago Up About an hour 80/tcp, 2003-2004/tcp, 2023-2024/tcp, 8125-8126/tcp, 8125/udp graphite1
Sample log output for one container.
root@elk-machine1:~/BELK# docker logs 8251763d3082
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/01_conf_init.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 14
Jun 7 09:15:13 graphite1 syslog-ng[26]: syslog-ng starting up; version='3.5.3'
Jun 7 09:17:01 graphite1 /USR/SBIN/CRON[59]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 7 10:17:01 graphite1 /USR/SBIN/CRON[62]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Can someone please help me to understand what I am doing wrong here?