The following gives steps and an outline on how to bring up an ELK stack for docker-compose stacks. An existing ELK stack exists in the docker-compose-demo github repository. This page assumes a working knowledge of docker and docker-compose.
- docker - minimum version: 20.10.16
- docker-compose - minimum version: 1.29.0
- elasticsearch - minimum version: 8.5.3
This example simply shows the containers for the ELK stack in a docker-compose form to be able to connect
with other containers. This example is easily expandable and if the containers to log are brought up with
docker-compose they can be added to the example yaml
given below or brought up in a seperate yaml
.
If the 'containers to log' are brought up seperately from the ELK stack yaml
then these are the most
important requirements
- The 'containers to log' use the same
NETWORK
as the ELK stack Elasticsearch
,kibana
, andlogstash
, are not present in anydepends_on
sections- Each container to log has a logging field (This is also required if the containers are in the same
yaml
). Example:
logging:
driver: gelf
options:
gelf-address: "udp://<hostIP>:12201"
tag: "container-to-log"
- A good tool to monitor individual Docker logs is Portainer. When running, portainer is viewable at localhost:9170
-
✏️ Specify a new directory to hold demonstration artifacts on the local host. Example:
export SENZING_DEMO_DIR=~/my-senzing
-
Create directory.
mkdir ${SENZING_DEMO_DIR}
-
Get versions of Docker images. Example:
curl -X GET \ --output ${SENZING_DEMO_DIR}/docker-versions-stable.sh \ https://raw.githubusercontent.com/Senzing/knowledge-base/main/lists/docker-versions-stable.sh source ${SENZING_DEMO_DIR}/docker-versions-stable.sh
-
Download
docker-compose.yaml
and Docker images. Example:curl -X GET \ --output ${SENZING_DEMO_DIR}/docker-compose.yaml \ "https://raw.githubusercontent.com/Senzing/docker-compose-demo/main/resources/custom/docker-compose-ELK.yaml" cd ${SENZING_DEMO_DIR} sudo --preserve-env docker-compose pull
-
Remember that the ELK stack takes a couple of minutes to start up, so ideally do this step before bringing up the container you wish to log, the stack is usually fully functional when kibana is viewable; during its startup, there will almost always be error logs.
-
Make sure you are in the directory with the
yaml
for the ELK stacksudo --preserve-env docker-compose up
- Give the ELK stack a few minutes to start and then logs are viewable in kibana at localhost:5601. Navigate to "Analytics" -> "Discover" to see logs