2020-06-21 08:21:09 +00:00
## Compose sample application
### Elasticsearch, Logstash, and Kibana (ELK) in single-node
Project structure:
```
.
2022-05-10 09:59:25 +00:00
└── compose.yaml
2020-06-21 08:21:09 +00:00
```
2022-05-10 09:59:25 +00:00
[_compose.yaml_ ](compose.yaml )
2020-06-21 08:21:09 +00:00
```
services:
elasticsearch:
image: elasticsearch:7.8.0
...
logstash:
image: logstash:7.8.0
...
kibana:
image: kibana:7.8.0
...
```
2022-05-10 09:59:25 +00:00
## Deploy with docker compose
2020-06-21 08:21:09 +00:00
```
2022-05-10 09:59:25 +00:00
$ docker compose up -d
2020-06-21 08:21:09 +00:00
Creating network "elasticsearch-logstash-kibana_elastic" with driver "bridge"
Creating es ... done
Creating log ... done
Creating kib ... done
```
## Expected result
Listing containers must show three containers running and the port mapping as below:
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
173f0634ed33 logstash:7.8.0 "/usr/local/bin/dock…" 43 seconds ago Up 41 seconds 0.0.0.0:5000->5000/tcp, 0.0.0.0:5044->5044/tcp, 0.0.0.0:9600->9600/tcp, 0.0.0.0:5000->5000/udp log
b448fd3e9b30 kibana:7.8.0 "/usr/local/bin/dumb…" 43 seconds ago Up 42 seconds 0.0.0.0:5601->5601/tcp kib
366d358fb03d elasticsearch:7.8.0 "/tini -- /usr/local…" 43 seconds ago Up 42 seconds (healthy) 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp es
```
After the application starts, navigate to below links in your web browser:
* Elasticsearch: [`http://localhost:9200` ](http://localhost:9200 )
* Logstash: [`http://localhost:9600` ](http://localhost:9600 )
2021-11-08 10:41:35 +00:00
* Kibana: [`http://localhost:5601/api/status` ](http://localhost:5601/api/status )
2020-06-21 08:21:09 +00:00
Stop and remove the containers
```
2022-05-10 09:59:25 +00:00
$ docker compose down
2020-06-21 08:21:09 +00:00
```
2020-07-24 00:32:09 +00:00
## Attribution
The [example Nginx logs ](https://github.com/docker/awesome-compose/tree/master/elasticsearch-logstash-kibana/logstash/nginx.log ) are copied from [here ](https://github.com/elastic/examples/blob/master/Common%20Data%20Formats/nginx_json_logs/nginx_json_logs ).