Skip to content

Instantly share code, notes, and snippets.

@caduvieira
Last active April 5, 2017 11:21
Show Gist options
  • Save caduvieira/b0fedad80423080a9365c19424fcfd9b to your computer and use it in GitHub Desktop.
Save caduvieira/b0fedad80423080a9365c19424fcfd9b to your computer and use it in GitHub Desktop.
ELK no docker

Commands:

docker run -d -v "$PWD/esdata":/usr/share/elasticsearch/data --name es elasticsearch:5.2.2

docker run -d --name logstash --link es:elasticsearch -v "$PWD":/config-dir logstash:5.2.2 -f /config-dir/logstash.conf

docker run --name kibana --link es:elasticsearch -p 5601:5601 -d kibana:5.2.2

docker run -d --net=host --name nginx --log-driver=gelf --log-opt gelf-address=udp://$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash):12201 --log-opt tag="Imagem:{{.ImageName}} - Nome:{{.Name}} - ID:{{.ID}}" -p 80:80 nginx

Have a logstash.conf in your working dir with:

input {
  gelf {}
}
output {
  elasticsearch {
    hosts => ["elasticsearch:9200"]
  }
}

See nginx at http://localhost See kibana at http://localhost:5601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment