Skip to content

Instantly share code, notes, and snippets.

@exekias
Created April 20, 2018 14:17
Show Gist options
  • Save exekias/e802ef376fdbbd4ba5872b57af4128bf to your computer and use it in GitHub Desktop.
Save exekias/e802ef376fdbbd4ba5872b57af4128bf to your computer and use it in GitHub Desktop.
Test Filebeat autodiscover conditions
version: '2.1'
services:
filebeat:
user: root
image: docker.elastic.co/beats/filebeat:6.2.4
volumes:
- ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
command: "filebeat -e -v --strict.perms=false"
apache:
image: httpd:latest
nginx:
image: nginx:latest
busybox:
image: busybox
command: "sh -c 'while true; do wget -q -O- apache > /dev/null; wget -q -O- nginx > /dev/null; sleep 5; done'"
filebeat.autodiscover:
providers:
- type: docker
templates:
- condition.or:
- contains.docker.container.name: "apache"
- contains.docker.container.name: "nginx"
config:
- type: docker
containers.ids:
- ${data.docker.container.id}
output.console:
pretty: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment