This repository helps to collect logs from the WeFlex servers. We use an ELK stack to process the logs.
Pre-requisite: Docker must be installed on the host machine.
- The WeflexLog Docker image is built from sebp/elk docker image. You can read the docs here.
- Filebeat is required to be installed and running on the host machine to publish logs to server. A sample config is shown below.
While deploying the config to production server, you must copy the public and private ssl keys to the docker container to
/etc/pki/tls/certs/logstash-beats.crt
and/etc/pki/tls/private/logstash-beats.key
OR any other path which must be consistent and communicated to filebeat and logstash config. To generate public and private keys, you can use letsencrypt.org service.
yum install filebeat
Copy the filebeat configuration to your host machine.
The below configuration does the following:
- It assumes that you have a log at
/Users/pbalan/Downloads/messages
on your host machine which is required to be monitored and published to logstash. See line 28.
You must change it to point to your log you want to publish.
- We set the tag to the logs published from the server on line 93.
- We set the env to the logs published from the server on line 98.
- Specify kibana host at line 123.
- Enable logstash output on line 154.
- Specify logstash host on line 157.
- Specify the path to ssl certifcate authorities on line 161.
sudo /etc/init.d/filebeat start
-
Use Dockerfile
docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name weflexlog_elk_1 weflextech/elk
-
Use docker-compose.yml
docker-compose up elk
Make sure the configuration files are up to date at /etc/logstash/conf.d/
by opening up a shell inside the docker container
docker exec -it <container-name> /bin/bash
-
Pull the latest image.
docker pull weflextech/elk:latest
-
Roll up a container if one is not running already.
docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name weflexlog_elk_1 weflextech/elk /bin/bash
-
ADD YOUR CHANGES.
-
Commit your changes.
docker commit -m <message> -a <user> weflexlog_elk_1 weflextech/elk:latest
-
Login to docker hub.
docker login
-
Push your changes.
docker push weflextech/elk