This repository is a simple demo to showcase a couple of things using Docker.
- Sending logs securely to Graylog using the syslog tcp+tls logging driver
- Using Consul and Registrator to monitor services dynamically
- Generate the syslog certs:
cd ./docker-log-alert/tls/syslog/
and then run./gen_certs.sh
(follow the prompts) EXTERNAL_IP=<host IP> docker-compose up -d
... the EXTERNAL_IP is IP or address this is running on. For the client-side Graylog API calls.- Connect to graylog:
http://<EXTERNAL_IP>:9001
User: admin Pass: admin- Go to "System/Input" -> "Content Packs" -> "Import Content Pack"
- Import the
./docker-log-alert/graylog/content_pack_nginx.json
content pack - Under "Content Packs" click on "Web Servers" and then "Apply Content Pack"
cd alerts
export CERT_PATH=$(pwd | sed 's/\/alerts//')
docker-compose up -d
- Build the curl script image
- From the
alerts
directory docker build --rm -t consul-curl .
docker run --rm --net=host consul-curl
- From the
- Scale the app
docker-compose scale app=10
- Simulate a failure
cd nginx
echo fail > status
orchmod 000 status
- In about 20s you should get an alert in Slack
- Investigate the error in Graylog by searching for
NOT response_status: 200