All Projects → gregbkr → Docker Elk Cadvisor Dashboards

gregbkr / Docker Elk Cadvisor Dashboards

ElasticSearch 1.7 (+data container) | Logstash 1.5.3 (+conf for elk logs) | Kibana 4 (+Dashboard for elk logs) | cAdvisor (Collect & View containers performance) | Nginx Proxy 1.9.3 (for SSL + password access).

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Docker Elk Cadvisor Dashboards

eslog tutorial
From Raw Logs to Real Insights - A tutorial for getting started with log analytics using Elastic Stack.
Stars: ✭ 28 (-66.27%)
Mutual labels:  logstash, elk
docker-elk
ELK Stack on Docker
Stars: ✭ 43 (-48.19%)
Mutual labels:  logstash, elk
xelogstash
Send SQL Server Extended Events to Logstash, Elastic Search, or JSON
Stars: ✭ 22 (-73.49%)
Mutual labels:  logstash, elk
data-processing-with-logstash
Contains the configuration files used within the Data Processing with Logstash course.
Stars: ✭ 76 (-8.43%)
Mutual labels:  logstash, elk
Elk Docker
Docker configuration for ELK monitoring stack with Curator and Beats data shippers support
Stars: ✭ 342 (+312.05%)
Mutual labels:  logstash, elk
ansible-role-kibana
Ansible Role - Kibana
Stars: ✭ 104 (+25.3%)
Mutual labels:  logstash, elk
Elk
搭建ELK日志分析平台。
Stars: ✭ 688 (+728.92%)
Mutual labels:  logstash, elk
ELK-Hunting
Threat Hunting with ELK Workshop (InfoSecWorld 2017)
Stars: ✭ 58 (-30.12%)
Mutual labels:  logstash, elk
Ansible Elk
📊 Ansible playbook for setting up an ELK/EFK stack and clients.
Stars: ✭ 284 (+242.17%)
Mutual labels:  logstash, elk
Helk
The Hunting ELK
Stars: ✭ 3,097 (+3631.33%)
Mutual labels:  logstash, elk
docker-elk-stack
The ELK stack Docker containerization (Elasticsearch, Logstash and Kibana)
Stars: ✭ 20 (-75.9%)
Mutual labels:  logstash, elk
Docker monitoring logging alerting
Docker host and container monitoring, logging and alerting out of the box using cAdvisor, Prometheus, Grafana for monitoring, Elasticsearch, Kibana and Logstash for logging and elastalert and Alertmanager for alerting.
Stars: ✭ 479 (+477.11%)
Mutual labels:  logstash, elk
elastic-stack
A complete documentation on how to install Elastic Stack on Ubuntu 16.04 Server ASAP 😎
Stars: ✭ 12 (-85.54%)
Mutual labels:  logstash, elk
spring-boot-microservice-eureka-zuul-docker-gateway-kubernetes
Spring Boot rest microservices using Kubernetes, ConfigMap, Eureka, Zuul / Spring Boot Gateway, Docker. Monitoring with logstash, logback, elasticsearch, kibana.
Stars: ✭ 86 (+3.61%)
Mutual labels:  logstash, elk
elastic-data-lake
Elastic Data Lake
Stars: ✭ 14 (-83.13%)
Mutual labels:  logstash, elk
tsharkVM
tshark + ELK analytics virtual machine
Stars: ✭ 51 (-38.55%)
Mutual labels:  logstash, elk
elk-dashboard-v5-docker
My production setup for the latest version of ELK stack running in a compose, displaying a basic -but powerfull- security and performance dashboard.
Stars: ✭ 25 (-69.88%)
Mutual labels:  logstash, elk
docker elk stack
Docker images to run an ELK stack
Stars: ✭ 24 (-71.08%)
Mutual labels:  logstash, elk
synesis lite syslog
Syslog collection with the Elastic Stack.
Stars: ✭ 31 (-62.65%)
Mutual labels:  logstash, elk
Justlog
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.
Stars: ✭ 439 (+428.92%)
Mutual labels:  logstash, elk

RUN LOGGING INFRA : ELK STACK (+ docker syslog driver)

ELK_Infra.png

0. Summary:

This build will setup ELK stack, and bring you dashboards in order to visualize ELK logs as a first example. You can run on the vagrant provided, or on a test host, where logs from already running docker containers will automatically be forwarded to ELK.

One Docker Compose will run:

  • ElasticSearch 1.7 (+data container)
  • Logstash 1.5.3 (+conf for elk logs)
  • Kibana 4 (+Dashboard for elk logs)
  • cAdvisor (Collect & View containers performance)
  • Ngnix Proxy 1.9.3 (for SSL + password access).

--> want to use the new version 5 of Elastic & kibana, have a look here: https://github.com/gregbkr/elk-dashboard-v5-docker

The result: Dashboard.png

1. Prerequisite: at the end of README.

2. Get all files from github

git clone https://github.com/gregbkr/docker-elk-cadvisor-dashboards

3. Rename and go to elk folder:

mv docker-elk-cadvisor-dashboards elk
cd elk

4. Run all containers:

(you probably get the error with port 80, see error section below)

docker-compose up -d

5. Deploy initialization:

Wait 5 min Deploy all init:

./deploy-init.sh

OR one by one:

Configure Kibana index pattern:

es-conf/indexpattern-init.sh

Configure storage for backup:

es-conf/backup-init.sh

Deploy fake logs (good to test Web dashboard for IP map):

kibana-conf/deploy-fake-logs.sh

6. Log on kibana to see the result

(If script failed configure manually the index pattern: in Setting > Indice : tick both boxes and select @timestamp)

http://dev.local:5601 (direct without proxy)

https://dev.local:5600 (!HTTPS ONLY! enter the credentials admin/Kibana05)

7. Import all dashboards and Searches:

Setting > Object > Import > /kibana-conf/export_vX.json

If some dashboards do not display well, need to wait 2 min for the data to come in, then refresh the fields in order to force ELK to initialize them now:

Setting > Indices > [logstash-]YYYY.MM.DD > Reload field list (the circle arrow in orange)

9. cAdvisor --> ELK

cAdvisor will catch containers metrics running on your docker host, and then send it to ELK. cAdvisor should already be running through docker-compose.

You can run other instance, on another host, via this standalone container: (if on another host, you will have to correct storage_driver_es_host)

docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:rw \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --publish=8888:8080 \
  --detach=true \
  --name=cadvisor \
  --link=elk_elasticsearch_1:elasticsearch \
  google/cadvisor:latest \
  -storage_driver="elasticsearch" -alsologtostderr=true -storage_driver_es_host="http://elk_elasticsearch_1:9200"

Access cAdvisor for live logs

http://dev.local:8888

Access metric through ELK:

You should already have some data in the dashboard cAdvisor. If not, please check index-mgmt.md setting index-pattern, or template (raw field)

#---------------------- Config -------------------------------

10. Logstash

Validate your config

You can run logstash to easily collect input string. Each input you paste in the invite will be process and output on screen by logstash. To setup, please run this container:

docker run -it --rm --name logstash -p 5001:5000 -p 5001:5000/udp -v $PWD/logstash-conf:/opt/logstash/conf.d logstash:1.5.3  -f /opt/logstash/conf.d/logstash-test.conf

And paste log messages like this and check if the output is correct. Make modification to logstash-test.conf and restart logstash container to refresh.

<14>2015-08-31T15:20:00 vagrant-ubuntu-trusty-64 docker/proxyelk[870]: 2015/07/20 17:19:13 routing all to syslog://dev.local:5000

If you got the field tags = ParseFailure, means your parsing is wrong somewhere... :-(

Modify log parsing

You can use https://grokdebug.herokuapp.com/ in order to check a log parsing.

#------ Backup and Restore and optimize ------

12. Index management (backup, restore, rotate)

Configure backup storage : (done in initialization step - in our case, backups will go in the $PWD/backup local folder)

es-conf/backup-init.sh

Edit as you wish (correct with you --host IP) and set cron job for backup, restore, index rotation:

crontab -l | cat es-conf/backup.crontab | crontab -

You can now monitor the backup via CURATOR dashboard

More info in file: index-mgmt.md

#---------------------- Stop and refresh -------------------

13. To stop compose

docker-compose stop

14. To refresh logstash after a modification in the logstash.conf file:

docker restart elk_logstash_1

#--------------------- TODO NEXT --------------------------

  • cAdvisor stats: correct some bugs and add more graphs.
  • Backup and restore: tests full recovery
  • Docker daemon logs to listen to container crashes
  • Event alerting (via email)

#---------------------- Errors ----------------------------------

Port in use:

listen tcp 0.0.0.0:80: bind: address already in use: --> stop nginx service:

sudo service nginx stop

Container seems to not run:

Checks logs on compose and container:

docker-compose logs
docker log -f elk_logstash_1

#--------------------Prerequisite -----------------------------

a. Use the vagrantfile provided in the root in order to have a configured environment with docker and compose already up to date.

b. In the whole page we use dev.local = your_host_ip = where the containers run. Please use your IP or map it in your local hosts file (laptop and vagrant VM).

ip a | grep 'scope global eth'

For Linux/MAC:

sudo nano /etc/hosts

For Windows (copy file to desktop, edit, and copy back ;-):

c:\windows\system32\etc\driver\hosts

c. Install Docker (1.8.1)

wget -qO- https://get.docker.com/ | sed 's/lxc-docker/lxc-docker-1.8.1/' | sh
gpasswd -a vagrant docker
service docker restart

d. Install Compose (1.4.0)

sudo sh -c "curl -L https://github.com/docker/compose/releases/download/1.4.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
sudo chmod +x /usr/local/bin/docker-compose
sudo sh -c "curl -L https://raw.githubusercontent.com/docker/compose/1.4.0/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose"

e. Firewall + Docker

Be carefull if you have firewall activated on the docker host. PLease follow that config:

start docker with --iptables=false : edit DOCKER_OPTS="--iptables=false"

sudo nano /etc/default/docker
sudo restart docker

FORWARD chain policy set to ACCEPT, edit DEFAULT_FORWARD_POLICY="ACCEPT"

sudo nano /etc/default/ufw
sudo ufw reload

Add the following NAT rule to allow outgoing connection from docker network:

iptables -t nat -A POSTROUTING ! -o docker0 -s 172.17.0.0/16 -j MASQUERADE

#-------------------- MISC -----------------------------

configure your own logo

(height: 45px; width: 252px)

docker cp kibana-conf/no_border.png elk_kibana_1:/opt/kibana/s rc/public/images

Clean up Docker to free space on host

Treesize: install and check your disk

apt-get install ncdu
ncdu /

Size of one path:

du -hs /path

Find all our data container:

docker ps -a | grep 'data'

Check your db size:

docker exec elk_elasticsearch_1 du -hs /var/lib/elasticsearch/data

BACKUP : Make a backup of your datacontainers: copy datacontainer data --> host:

cd to/your/backup/folder
docker run --rm --volumes-from elk_elasticdata_1 -v $PWD:/backup ubuntu tar cvf /backup/datacontainer-var-lib-elasticsearch-data_`date +%d-%m-%Y"_"%Hh%Mm%Ss`.tar /var/lib/elasticsearch/data

LIST dangling/orphan images:

docker images -f dangling=true | awk '{if(NR>1) print $0}'

DELETE dangling/orphan image: (not use or orphan images)

docker images -f dangling=true | awk '{if(NR>1) print $3}' | xargs docker rmi

LIST only created/exited weeks ago (and NOT minute/day), and NOT data container (container_name NOT contains "data") (please double check if no datacontainer inside that list)

docker ps -a -f status=exited | grep -v 'data'| grep -v 'minute' | grep -v 'day' | grep week

DELETE this list above:

docker ps -a -f status=exited | grep -v 'data'| grep -v 'minute' | grep -v 'day' | grep week | awk '{if(NR>1) print $1}' | xargs -r docker rm

LIST dead container:

docker ps -a -f status=dead | grep -v 'data'

DELETE dead container:

docker ps -a -f status=dead | grep -v 'data' | awk '{if(NR>1) print $1}' | xargs -r docker rm
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].