SlideShare une entreprise Scribd logo
1  sur  36
Monitoring Containers
with the ELK Stack
Solomon Hykes, DockerCon
2016
Daniel Berman
• Product Evangelist @Logzio
• LAMPer
• Contributor on SitePoint and DZone
• TLV-PHP Meetup organizer
• @proudboffin, daniel@logz.io
2-Mins on
• End-to-end ELK as a service
• Auto-scaling, secure
• SOC-II compliant, ISO27001
• AWS-based
• Alerting, user-control, ELK Apps
Agenda
• Why logging?
• The logging challenge
• The Docker challenge
• Common logging solutions
• Introducing ELK
• Docker log collector
• Demo
• Questions?
RFID Windows App
Database
asd
Sensors App server
Mainframe Active directory
Network Security
Exchange
Why logging?
Web server
State of logging
The shift to open source
The logging challenge
The logging challenge
• No centralization
• No consistency
• No accessibility
* Puppet DevOps Survey
2016
The Docker challenge
Distribution and
diversification
2016-06-02T13:05:22.614090Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2522067
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
3747bd397456 0.01% 3.641 MB / 2.1 GB 0.17% 3.366 kB / 648 B 0 B / 0 B
396e42ba0d15 0.11% 1.638 MB / 2.1 GB 0.08% 9.79 kB / 648 B 348.2 kB / 0 B
468bf755240a 3.19% 45.67 MB / 2.1 GB 2.17% 25.19 MB / 17.95 MB 774.1 kB / 0 B
5f16814a3c0e 0.01% 495.6 kB / 2.1 GB 0.02% 8.564 kB / 648 B 0 B / 0 B
74cdfa7b8a0c 0.04% 3.908 MB / 2.1 GB 0.19% 2.028 kB / 648 B 0 B / 0 B
99bafb7600fc 0.00% 32.95 MB / 2.1 GB 1.57% 0 B / 0 B 2.093 MB / 20.48 kB
a48f7ba0ace7 0.04% 390.4 MB / 2.1 GB 18.59% 4.704 kB / 648 B 31.29 MB / 306.5 MB
d7b60560e4d8 0.27% 220.9 MB / 2.1 GB 10.52% 7.338 kB / 648 B 94.21 kB / 114.7 kB
$ docker logs
$ docker stats
$ docker daemon
time="2016-06-05T12:03:49.716900785Z" level=debug msg="received containerd event: &types.Event{Type:"exit",
Id:"3747bd397456cd28058bb40799cd0642f431849b5c43ce56536ab7f55a98114f", Status:0x0,
Pid:"4120a7625a592f7c95eab4b1b442a45370f6dd95b63d284714dbb58f00d0a20d", Timestamp:0x57541525}"
Containers are transient
$ tail -f
is not enough
Common logging solutions
• Application logging (data volumes)
• Logspout
• Drivers - json-file (default), syslog, fluentd, gelf,
journald
• Monitoring/Logging tools - Datadog, Papertail,
Dynatrace, Sysdig
• World’s most popular open source log analysis platform
• 4.5M downloads a month!
• Centralized logging AND: search, BI, SEO, IoT, and more
Introducing ELK
Old school logging
$ grep ' 30[1234] ' /var/logs/apache2/access.log | grep -v
baidu | grep -v Googlebot
173.230.156.8 - - [04/Sep/2015:06:10:10 +0000] "GET /morpht HTTP/1.0" 301 26
"-" "Mozilla/5.0 (pc-x86_64-linux-gnu)"
192.3.83.5 - - [04/Sep/2015:06:10:22 +0000] "GET /?q=node/add HTTP/1.0" 301
26 "http://morpht.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1)
AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5"
192.3.83.5 - - [04/Sep/2015:06:10:23 +0000] "GET /?q=user/register HTTP/1.0"
301 26 "http://morpht.com/node/add" "Mozilla/5.0 (Macintosh; Intel Mac OS X
10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.
2.5"
New school logging
type:apache AND website: "mysite" AND response: [500 TO *]
• A full-text search & analytics engine
• Open source, written in Java and based on Apache
Lucene
• Designed for speed, scalability and high availability
• Advanced querying using REST API
• Collects, processes, and forwards logs
• Over 200 input, filter and output plugins for
manipulating the data
• Open source visualization platform
• For querying and analyzing logs
• Visualizations and monitoring dashboards
The ELK pipeline
Docker —> ELK
Setup ELK: Install Elasticsearch, Logstash and Kibana
• Elasticsearch - https://hub.docker.com/_/elasticsearch/
• Logstash - https://hub.docker.com/_/logstash/
• Kibana - https://hub.docker.com/_/kibana/
• Full stack: https://hub.docker.com/r/sebp/elk/
Docker —> ELK
• Use syslog logging driver
logging:
driver: syslog
options:
syslog-address: "udp://$IP_LOGSTASH:5000"
syslog-tag: “nginx-with-syslog"
• Use logspout and Logstash module :
input {
udp {
port => 5000
codec => json
}
}
Docker Log Collector
• Dedicated container
• Unified logging layer, fetching:
• Docker logs from all the running containers per
Docker host
• Docker stats for all the containers
• Docker daemon events
How it works
• Based on docker-loghose and docker-stats
• POST /containers/{id}/attach, to fetch the logs
• GET /containers/{id}/stats, to fetch the stats of the
container
• GET /containers/json, to detect the containers that are
running when this module starts
• GET /events, to detect new containers that will start
after the module has started
Running it
$ docker pull logzio/logzio-docker
$ docker run -d --restart=always -v
/var/run/docker.sock:/var/run/docker.sock
logzio/logzio-docker -t
UfKqCazQjUYnBNcJqSryIRyDIjExjwIZ
Running options
-- no-stats, to not send stats
-- no-logs, to not send logs
-- no-dockerEvents, to not send daemon events
-i/-- statsinterval, to set the stats interval
-a, custom tag
-- matchByName / -skipByName, blacklist or whitelist
containers
What metrics to look out for
• Errors and warnings
• Container CPU%
• Container memory usage
• # of running containers
• Network usage
Demo time!
Resources
• Logz.io blog: http://logz.io/blog/
• Elastic: https://www.elastic.co/learn
• Loggly blog:
https://www.loggly.com/blog/topic/general/
Thanks!
@proudboffin |
daniel@logz.io
Performance agent
$ docker pull logzio/logzio-perfagent
$ docker run -d --net="host" -e
LOGZ_TOKEN="UfKqCazQjUYnBNcJqSryIRyDIjExjwIZ"-
e USER_TAG="workers" -e HOSTNAME=`hostname` -
e INSTANCE="10.1.2.3" --restart=always
logzio/logzio-perfagent

Contenu connexe

Tendances

Tendances (20)

Logstash
LogstashLogstash
Logstash
 
Elk devops
Elk devopsElk devops
Elk devops
 
elk_stack_alexander_szalonnas
elk_stack_alexander_szalonnaselk_stack_alexander_szalonnas
elk_stack_alexander_szalonnas
 
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
Customer Intelligence: Using the ELK Stack to Analyze ForgeRock OpenAM Audit ...
 
Logstash family introduction
Logstash family introductionLogstash family introduction
Logstash family introduction
 
More kibana
More kibanaMore kibana
More kibana
 
ELK introduction
ELK introductionELK introduction
ELK introduction
 
Logstash
LogstashLogstash
Logstash
 
ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)
 
Docker Logging Webinar
Docker Logging  WebinarDocker Logging  Webinar
Docker Logging Webinar
 
The ELK Stack - Get to Know Logs
The ELK Stack - Get to Know LogsThe ELK Stack - Get to Know Logs
The ELK Stack - Get to Know Logs
 
Elastic - ELK, Logstash & Kibana
Elastic - ELK, Logstash & KibanaElastic - ELK, Logstash & Kibana
Elastic - ELK, Logstash & Kibana
 
Collect distributed application logging using fluentd (EFK stack)
Collect distributed application logging using fluentd (EFK stack)Collect distributed application logging using fluentd (EFK stack)
Collect distributed application logging using fluentd (EFK stack)
 
Elastic{ON} 2016 Review - 김종민 님
Elastic{ON} 2016 Review - 김종민 님Elastic{ON} 2016 Review - 김종민 님
Elastic{ON} 2016 Review - 김종민 님
 
Logging logs with Logstash - Devops MK 10-02-2016
Logging logs with Logstash - Devops MK 10-02-2016Logging logs with Logstash - Devops MK 10-02-2016
Logging logs with Logstash - Devops MK 10-02-2016
 
Shipping & Visualize Your Data With ELK
Shipping  & Visualize Your Data With ELKShipping  & Visualize Your Data With ELK
Shipping & Visualize Your Data With ELK
 
Logstash: Get to know your logs
Logstash: Get to know your logsLogstash: Get to know your logs
Logstash: Get to know your logs
 
Journée DevOps : Des dashboards pour tous avec ElasticSearch, Logstash et Kibana
Journée DevOps : Des dashboards pour tous avec ElasticSearch, Logstash et KibanaJournée DevOps : Des dashboards pour tous avec ElasticSearch, Logstash et Kibana
Journée DevOps : Des dashboards pour tous avec ElasticSearch, Logstash et Kibana
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.com
 
ELK stack at weibo.com
ELK stack at weibo.comELK stack at weibo.com
ELK stack at weibo.com
 

En vedette

Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Andrii Vozniuk
 
Venture classpresentation
Venture classpresentationVenture classpresentation
Venture classpresentation
Anton Tyukov
 
Log analysis with the elk stack
Log analysis with the elk stackLog analysis with the elk stack
Log analysis with the elk stack
Vikrant Chauhan
 

En vedette (20)

Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
Interactive learning analytics dashboards with ELK (Elasticsearch Logstash Ki...
 
Lessons Learned in Deploying the ELK Stack (Elasticsearch, Logstash, and Kibana)
Lessons Learned in Deploying the ELK Stack (Elasticsearch, Logstash, and Kibana)Lessons Learned in Deploying the ELK Stack (Elasticsearch, Logstash, and Kibana)
Lessons Learned in Deploying the ELK Stack (Elasticsearch, Logstash, and Kibana)
 
Using ELK-Stack (Elasticsearch, Logstash and Kibana) with BizTalk Server
Using ELK-Stack (Elasticsearch, Logstash and Kibana) with BizTalk ServerUsing ELK-Stack (Elasticsearch, Logstash and Kibana) with BizTalk Server
Using ELK-Stack (Elasticsearch, Logstash and Kibana) with BizTalk Server
 
Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)
Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)
Monitoring the ELK stack using Zabbix and Grafana (Dennis Kanbier / 26-11-2015)
 
Intro to sysdig in 15 minutes
Intro to sysdig in 15 minutesIntro to sysdig in 15 minutes
Intro to sysdig in 15 minutes
 
The Dark Art of Container Monitoring - Spanish
The Dark Art of Container Monitoring - SpanishThe Dark Art of Container Monitoring - Spanish
The Dark Art of Container Monitoring - Spanish
 
Interactive Animated Projected Elk Map and Terrain Model
Interactive Animated Projected Elk Map and Terrain Model Interactive Animated Projected Elk Map and Terrain Model
Interactive Animated Projected Elk Map and Terrain Model
 
Venture classpresentation
Venture classpresentationVenture classpresentation
Venture classpresentation
 
Extending Sysdig with Chisel
Extending Sysdig with ChiselExtending Sysdig with Chisel
Extending Sysdig with Chisel
 
Building Trustworthy Containers
Building Trustworthy ContainersBuilding Trustworthy Containers
Building Trustworthy Containers
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
 
09 application security fundamentals - part 2 - security mechanisms - logging
09   application security fundamentals - part 2 - security mechanisms - logging09   application security fundamentals - part 2 - security mechanisms - logging
09 application security fundamentals - part 2 - security mechanisms - logging
 
Web Application Security 101 - 12 Logging
Web Application Security 101 - 12 LoggingWeb Application Security 101 - 12 Logging
Web Application Security 101 - 12 Logging
 
Behavioural activity monitoring on CoreOS with Sysdig Falco
Behavioural activity monitoring on CoreOS with Sysdig FalcoBehavioural activity monitoring on CoreOS with Sysdig Falco
Behavioural activity monitoring on CoreOS with Sysdig Falco
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
 
Introduction to ELK
Introduction to ELKIntroduction to ELK
Introduction to ELK
 
Log analysis with the elk stack
Log analysis with the elk stackLog analysis with the elk stack
Log analysis with the elk stack
 
IT Infrastructure Monitoring Strategies in Healthcare
IT Infrastructure Monitoring Strategies in HealthcareIT Infrastructure Monitoring Strategies in Healthcare
IT Infrastructure Monitoring Strategies in Healthcare
 
Elk with Openstack
Elk with OpenstackElk with Openstack
Elk with Openstack
 
Docker Indy Meetup Monitoring 30-Aug-2016
Docker Indy Meetup Monitoring 30-Aug-2016Docker Indy Meetup Monitoring 30-Aug-2016
Docker Indy Meetup Monitoring 30-Aug-2016
 

Similaire à Monitoring Docker with ELK

Similaire à Monitoring Docker with ELK (20)

Machine Learning and Logging for Monitoring Microservices
Machine Learning and Logging for Monitoring Microservices Machine Learning and Logging for Monitoring Microservices
Machine Learning and Logging for Monitoring Microservices
 
Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane
 
Elk for applications on k8s
Elk for applications on k8sElk for applications on k8s
Elk for applications on k8s
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
 
Host Health Monitoring with Docker Run
Host Health Monitoring with Docker RunHost Health Monitoring with Docker Run
Host Health Monitoring with Docker Run
 
OSMC 2021 | Use OpenSource monitoring for an Enterprise Grade Platform
OSMC 2021 | Use OpenSource monitoring for an Enterprise Grade PlatformOSMC 2021 | Use OpenSource monitoring for an Enterprise Grade Platform
OSMC 2021 | Use OpenSource monitoring for an Enterprise Grade Platform
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
 
DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and...
 DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and... DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and...
DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and...
 
Postgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPostgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh Shah
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
Open shift enterprise 3.1 paas on kubernetes
Open shift enterprise 3.1   paas on kubernetesOpen shift enterprise 3.1   paas on kubernetes
Open shift enterprise 3.1 paas on kubernetes
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
OpenShift Enterprise 3.1 vs kubernetes
OpenShift Enterprise 3.1 vs kubernetesOpenShift Enterprise 3.1 vs kubernetes
OpenShift Enterprise 3.1 vs kubernetes
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
A fun cup of joe with open liberty
A fun cup of joe with open libertyA fun cup of joe with open liberty
A fun cup of joe with open liberty
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Monitoring Docker with ELK

  • 3. Daniel Berman • Product Evangelist @Logzio • LAMPer • Contributor on SitePoint and DZone • TLV-PHP Meetup organizer • @proudboffin, daniel@logz.io
  • 4.
  • 5. 2-Mins on • End-to-end ELK as a service • Auto-scaling, secure • SOC-II compliant, ISO27001 • AWS-based • Alerting, user-control, ELK Apps
  • 6. Agenda • Why logging? • The logging challenge • The Docker challenge • Common logging solutions • Introducing ELK • Docker log collector • Demo • Questions?
  • 7. RFID Windows App Database asd Sensors App server Mainframe Active directory Network Security Exchange Why logging? Web server
  • 9. The shift to open source
  • 11. The logging challenge • No centralization • No consistency • No accessibility * Puppet DevOps Survey 2016
  • 14. 2016-06-02T13:05:22.614090Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2522067 CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O 3747bd397456 0.01% 3.641 MB / 2.1 GB 0.17% 3.366 kB / 648 B 0 B / 0 B 396e42ba0d15 0.11% 1.638 MB / 2.1 GB 0.08% 9.79 kB / 648 B 348.2 kB / 0 B 468bf755240a 3.19% 45.67 MB / 2.1 GB 2.17% 25.19 MB / 17.95 MB 774.1 kB / 0 B 5f16814a3c0e 0.01% 495.6 kB / 2.1 GB 0.02% 8.564 kB / 648 B 0 B / 0 B 74cdfa7b8a0c 0.04% 3.908 MB / 2.1 GB 0.19% 2.028 kB / 648 B 0 B / 0 B 99bafb7600fc 0.00% 32.95 MB / 2.1 GB 1.57% 0 B / 0 B 2.093 MB / 20.48 kB a48f7ba0ace7 0.04% 390.4 MB / 2.1 GB 18.59% 4.704 kB / 648 B 31.29 MB / 306.5 MB d7b60560e4d8 0.27% 220.9 MB / 2.1 GB 10.52% 7.338 kB / 648 B 94.21 kB / 114.7 kB $ docker logs $ docker stats $ docker daemon time="2016-06-05T12:03:49.716900785Z" level=debug msg="received containerd event: &types.Event{Type:"exit", Id:"3747bd397456cd28058bb40799cd0642f431849b5c43ce56536ab7f55a98114f", Status:0x0, Pid:"4120a7625a592f7c95eab4b1b442a45370f6dd95b63d284714dbb58f00d0a20d", Timestamp:0x57541525}"
  • 16. $ tail -f is not enough
  • 17. Common logging solutions • Application logging (data volumes) • Logspout • Drivers - json-file (default), syslog, fluentd, gelf, journald • Monitoring/Logging tools - Datadog, Papertail, Dynatrace, Sysdig
  • 18. • World’s most popular open source log analysis platform • 4.5M downloads a month! • Centralized logging AND: search, BI, SEO, IoT, and more Introducing ELK
  • 19. Old school logging $ grep ' 30[1234] ' /var/logs/apache2/access.log | grep -v baidu | grep -v Googlebot 173.230.156.8 - - [04/Sep/2015:06:10:10 +0000] "GET /morpht HTTP/1.0" 301 26 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu)" 192.3.83.5 - - [04/Sep/2015:06:10:22 +0000] "GET /?q=node/add HTTP/1.0" 301 26 "http://morpht.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5" 192.3.83.5 - - [04/Sep/2015:06:10:23 +0000] "GET /?q=user/register HTTP/1.0" 301 26 "http://morpht.com/node/add" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600. 2.5"
  • 20. New school logging type:apache AND website: "mysite" AND response: [500 TO *]
  • 21. • A full-text search & analytics engine • Open source, written in Java and based on Apache Lucene • Designed for speed, scalability and high availability • Advanced querying using REST API
  • 22. • Collects, processes, and forwards logs • Over 200 input, filter and output plugins for manipulating the data
  • 23. • Open source visualization platform • For querying and analyzing logs • Visualizations and monitoring dashboards
  • 25. Docker —> ELK Setup ELK: Install Elasticsearch, Logstash and Kibana • Elasticsearch - https://hub.docker.com/_/elasticsearch/ • Logstash - https://hub.docker.com/_/logstash/ • Kibana - https://hub.docker.com/_/kibana/ • Full stack: https://hub.docker.com/r/sebp/elk/
  • 26. Docker —> ELK • Use syslog logging driver logging: driver: syslog options: syslog-address: "udp://$IP_LOGSTASH:5000" syslog-tag: “nginx-with-syslog" • Use logspout and Logstash module : input { udp { port => 5000 codec => json } }
  • 27. Docker Log Collector • Dedicated container • Unified logging layer, fetching: • Docker logs from all the running containers per Docker host • Docker stats for all the containers • Docker daemon events
  • 28. How it works • Based on docker-loghose and docker-stats • POST /containers/{id}/attach, to fetch the logs • GET /containers/{id}/stats, to fetch the stats of the container • GET /containers/json, to detect the containers that are running when this module starts • GET /events, to detect new containers that will start after the module has started
  • 29. Running it $ docker pull logzio/logzio-docker $ docker run -d --restart=always -v /var/run/docker.sock:/var/run/docker.sock logzio/logzio-docker -t UfKqCazQjUYnBNcJqSryIRyDIjExjwIZ
  • 30. Running options -- no-stats, to not send stats -- no-logs, to not send logs -- no-dockerEvents, to not send daemon events -i/-- statsinterval, to set the stats interval -a, custom tag -- matchByName / -skipByName, blacklist or whitelist containers
  • 31. What metrics to look out for • Errors and warnings • Container CPU% • Container memory usage • # of running containers • Network usage
  • 33.
  • 34. Resources • Logz.io blog: http://logz.io/blog/ • Elastic: https://www.elastic.co/learn • Loggly blog: https://www.loggly.com/blog/topic/general/
  • 36. Performance agent $ docker pull logzio/logzio-perfagent $ docker run -d --net="host" -e LOGZ_TOKEN="UfKqCazQjUYnBNcJqSryIRyDIjExjwIZ"- e USER_TAG="workers" -e HOSTNAME=`hostname` - e INSTANCE="10.1.2.3" --restart=always logzio/logzio-perfagent

Notes de l'éditeur

  1. Need to start looking at our Docker environment from a more high level view. This talk will also try and approach Docker from a more holistic point of view.
  2. One picture is worth 1000 words! Chaos
  3. Logging is hands down the best way to see how your application is behaving, and when utilized properly allows you to catch problems early and make key technical decisions. IT infrastructures on the cloud
  4. Multiple use cases across operations, security, BI and IoT
  5. Log analytics market - divided into two disproportionate parts Splunk invented the space, small section of the market. Majority of the market are using ELK. Open source sitting on the convergence of various log analytics software: Hadoop, Spark, Elasticsearch Hadoop, Spark, Graphite, Kafka…ELK!
  6. Log analysis is like automated testing. Everyone know they need to do it, but no one ever does do it.
  7. Logs are coming in from a huge amount of servers all over the place - they can be on the cloud, local or hybrid. Puppet survey. Logging is different for each app/system: PHP/node, apache/nginx Large production environments consist of hundreds of servers Large data volume, difficult to find - remote access, authentication SSHing + GREPing is simply not enough
  8. Multiple containers per host, each with its own env, dedicated process - monitoring logs for each container is not a viable option Number of processes running within the same container Logz.io: 60 hosts running at any given time, each with a number of containers
  9. Various types of data being outputted by each container
  10. Traditional logging and monitoring took metrics static servers with long uptime Containers come and go, constantly moving, dynamic - some Docker servers run hundreds of short-term containers s You can’t log to the container since the data will be lost
  11. Data is no longer persistent and accessible, in the container era - data is ephemeral and distributed, turning log analytics into an engineering art Log analytics has become black magic - not unprone to human mistakes and errors.
  12. Application logging using data volumes - app handles logging using a logging framework, drawbacks: requires setup in app, no stats/events Logspout - runs as a container per host, drawbacks: only for stdout/stderr, no stats/events, not meant for management so no retention. Extremely popular (Datadog research) Drivers - drawbacks: tough to troubleshoot and administrate, miss out on daemon events and stats, requires extra config SaaS - cost, focus on monitoring metrics
  13. Why so popular? Simple and beautiful! Easy to get started UI is awesome! Open Source and free! Fast, very fast!
  14. Website down scenario
  15. Distributed architecture (sharding, replication) allows for huge capacity, scaling up to hundreds of servers and storing petabytes of data On the same hardware, queries that would take more than 10 seconds using SQL will return results in under 10 milliseconds in Elasticsearch. The result of all this is: a fast, scalable and reliable data store that can power any data discovery application.
  16. The stack’s workhorse - can process data from any source Hundreds of output plugins: AWS S3, MongoDB, Redis, Riak and many more
  17. 2225 Elasticsearch images Over 100K pulls, configures log rotation, certification keys for log shippers.
  18. In both cases, stdout and stderr output Downfalls: Per host Resource consumption No stats/events
  19. Dedicated container making logging a part of the architecture Simplified scaling - simply run a container Daemon events: attach, commit, copy, create, destroy, detach, die, etc. — for understanding the lifecycle of containers
  20. On GitHub, so you can customize it any way you want.
  21. Errors and warnings Container CPU% - will help you set CPU limits for containers Container memory usage - will help you set memory limits for containers # of running containers - handy during deployments and updates to check that everything is running like before Network usage
  22. No silver bullet! (Bela Lugosi, 1931) Docker is still not mature enough, does not mean that logging is not necessary! ELK - is scalable, adds visualization layer, easier centralized analysis
  23. Monitoring host performance (not just Docker) collectl Rsyslog