Elastic.co provides a handy Docker image for the ELK stack (Elasticsearch Logstash Kibana). The Docker image gets you up and running an ELK system fast. This script is a quick hack to use the ELK image with other development VMs running with Vagrant and Hyper-V.
- Copy the Powershell script to your project folder.
- Change the IP Address variable in the script.
$HOST_IP = "192.168.1.67" # change to the Docker host computer's IP Address
- docker run -p maps container ports to the host's localhost interface.
docker run --name elk -p 127.0.0.1:5044:5044 -p 127.0.0.1:5601:5601 -p 127.0.0.1:9200:9200 sebp/elk
- netsh interface portproxy add v4tov4 maps localhost ports to the external network interface that the Hyper-V VMs can access.
netsh interface portproxy add v4tov4 listenport=5044 listenaddress=$HOST_IP connectaddress=localhost connectport=5044
netsh interface portproxy add v4tov4 listenport=5601 listenaddress=$HOST_IP connectaddress=localhost connectport=5601
netsh interface portproxy add v4tov4 listenport=9200 listenaddress=$HOST_IP connectaddress=localhost connectport=9200
- New-NetFirewallRule creates Windows Inbound Firewall rules.
New-NetFirewallRule -DisplayName "ELK / Docker Logstash" -Direction Inbound -LocalPort 5044 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "ELK / Docker Kibana" -Direction Inbound -LocalPort 5601 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "ELK / Docker ElasticSearch" -Direction Inbound -LocalPort 9200 -Protocol TCP -Action Allow