SlideShare a Scribd company logo
Logging & Metrics With Docker
A Comprehensive Monitoring Solution
Stefan Zier
June 13th, 2015
whoami
Infrastructure, Backend Dev/Architect
Chief Architect, Sumo Logic, since 2010
Server & Infrastructure, ArcSight (HP), 2001-2010
Mandatory Slide Showing Shipping Containers
Docker – What’s making debugging hard?
One more layer of abstraction
Container per app = File system per
process
File systems short lived, transient
Resource schedulers = no container
affinity to host
What Our Customers Are Telling Us
We have one process per container
We like to log to stdout
We have multiple processes per container
We run the Sumo Logic collector on the Docker host
We are looking into using Beanstalk with Docker
We are using Amazon ECS
Everyone here loves Docker
We are logging straight from the application
We are using /dev/log for Syslog
We want immutable infrastructure
Goal
Get logs from our containerized applications
to a centralized logging platform.
How do apps emit logs
Append to a file
Use syslog()
Use log4j, log4net, slf4, etc.
printf() to stdout
Getting logs out of the container - Files
Use VOLUME to mount a host directory
Collect files from the host
Collect files from another container sharing the VOLUME
Need to manage disk space, i.e. rotate logs
App (where supported)
Host
Yet another container with logrotate
Logging & Metrics with Docker
docker run -v /tmp/clogs:/tmp/clogs -d
--name="sumo-logic-collector"
sumologic/collector:latest-file [Access ID] [Access key]
Getting logs out - Syslog
VOLUME /dev/log from host and use host syslogd
Run a syslogd inside the container
Emit TCP/UDP
Write to a file using VOLUME
Emit syslog TCP/UDP directly from the app
Logging & Metrics with Docker
docker run -d -p 514:514 -p 514:514/udp 
--name="sumo-logic-collector” 
sumologic/collector:latest-syslog [Access ID] [Access key]
Getting logs out – Logging frameworks
Sumo Logic blog on official collector images
http://www.sumologic.com/blog/company/an-official-docker-image-for-
the-sumo-logic-collector
https://github.com/SumoLogic/sumologic-collector-docker
Rainer Gerhards on Rsyslog’s file input module
http://www.slideshare.net/rainergerhards1/using-wildcards-with-
rsyslogs-file-monitor-imfile
OWASP Log Injection
https://www.owasp.org/index.php/Log_injection
Getting logs out – Logging frameworks
Directly to network destinations
HTTP/HTTPS
Also support files, stdout, etc.
Logging & Metrics with Docker
Getting logs out – Logging frameworks
Various application stacks
http://help.papertrailapp.com/
Log4J
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html
Apache Web Server
http://httpd.apache.org/docs/trunk/mod/mod_syslog.html
https://raymii.org/s/snippets/Apache_access_and_error_log_to_syslog.html
Nginx
http://nginx.org/en/docs/syslog.html
Postgres
http://www.postgresql.org/docs/9.1/static/runtime-config-logging.html
Sumo Logic blog on official syslog collector image
http://www.sumologic.com/blog/company/an-official-docker-image-for-the-sumo-logic-collector
https://github.com/SumoLogic/sumologic-collector-docker
Getting logs out – stdout
Simply printf()
Logging framework to console
Symlink to /dev/stdout or /dev/stderr
Configure paths to /dev/stdout or /dev/stderr
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
Docker Logging Drivers
What Docker provides
Captures stdout/stderr
Feeds it to logging drivers
docker logs command
Returns the entire log every time
Works with json-file driver only
Can tail logs
docker logs –tf –-tail 0 [ID]
Docker Logging Drivers
Configured on docker run
stdout and stderr dispatched to drivers
json-file (default pre 1.6)
syslog
journald
No stats, no events
json-file driver
Output unbounded, can fill up the host disk
Requires logrotate on the Docker host
https://github.com/docker/docker/issues/7333
Stats
Docker Stats
Per-container cgroups metrics (like docker stats)
Memory
CPU
Block I/O
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
collector 2.23% 232.6 MiB/2 GiB 11.36% 191.9 KiB/636.3 KiB
Requirements
How would we want it to work?
What information do we want to collect?
Timestamp
Log message
Docker host info
Container ID
Image ID
Process ID
How should it work?
Use docker logging infrastructure
Minimal moving parts
Containerized - don’t touch the host
Complete – pick up all available data
Automatically discover new containers
Docker API
The solution maybe?
Docker API
Docker daemon has a REST API
TCP or unix socket
Streaming APIs
Docker Events (container lifecycle updates)
Container Stats (CPU, memory used, …)
App Logs (container stdout/stderr)
Collecting via Docker API
Discover new containers via events
Start streaming their logs and stats
When they go away, stop
Do all of this via the API
Send all of it to centralized log management
Collecting via Docker API, continued
Single component to do it
Zero footprint on the host
Follows Docker standard way of logging
One more thing…
Introducing:
Sumo Logic Docker Source
Sumo Logic Docker Source
Active development
Early access expected later this year
Demo Time
fin.
Questions?
@stefanzier

More Related Content

What's hot (20)

PDF
Fluentd and PHP
chobi e
 
PPTX
Docker practical solutions
Kesav Kumar Kolla
 
PDF
Getting instantly up and running with Docker and Symfony
André Rømcke
 
PDF
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
bridgetkromhout
 
PPT
Build service with_docker_in_90mins
Larry Cai
 
PDF
Dockerize your Symfony application - Symfony Live NYC 2014
André Rømcke
 
PPTX
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Alexey Petrov
 
PDF
Docker and Fluentd
SATOSHI TAGOMORI
 
PDF
Project Atomic-Nulecule
Lalatendu Mohanty
 
PPTX
Docker 1.11 Presentation
Sreenivas Makam
 
PDF
Docker 101 2015-05-28
Adrian Otto
 
PDF
Docker up and running
Victor S. Recio
 
PDF
runC: The little engine that could (run Docker containers) by Docker Captain ...
Docker, Inc.
 
PDF
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
PDF
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.
 
PPT
Docker Multi Host Networking, Rachit Arora, IBM
Neependra Khare
 
PDF
Docker for Developers - Part 1 by David Gageot
Docker, Inc.
 
PPTX
Intro- Docker Native for OSX and Windows
Thomas Chacko
 
PDF
Containerd: Building a Container Supervisor by Michael Crosby
Docker, Inc.
 
PDF
Docker Distributed application bundle & Stack - Overview
Thomas Chacko
 
Fluentd and PHP
chobi e
 
Docker practical solutions
Kesav Kumar Kolla
 
Getting instantly up and running with Docker and Symfony
André Rømcke
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
bridgetkromhout
 
Build service with_docker_in_90mins
Larry Cai
 
Dockerize your Symfony application - Symfony Live NYC 2014
André Rømcke
 
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Alexey Petrov
 
Docker and Fluentd
SATOSHI TAGOMORI
 
Project Atomic-Nulecule
Lalatendu Mohanty
 
Docker 1.11 Presentation
Sreenivas Makam
 
Docker 101 2015-05-28
Adrian Otto
 
Docker up and running
Victor S. Recio
 
runC: The little engine that could (run Docker containers) by Docker Captain ...
Docker, Inc.
 
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
Docker Security Deep Dive by Ying Li and David Lawrence
Docker, Inc.
 
Docker Multi Host Networking, Rachit Arora, IBM
Neependra Khare
 
Docker for Developers - Part 1 by David Gageot
Docker, Inc.
 
Intro- Docker Native for OSX and Windows
Thomas Chacko
 
Containerd: Building a Container Supervisor by Michael Crosby
Docker, Inc.
 
Docker Distributed application bundle & Stack - Overview
Thomas Chacko
 

Viewers also liked (20)

PDF
Log Analysis @ Outsmart Games
Nathan Smith
 
PPTX
Shipping your logs to elk from mule app/cloudhub part 1
Alex Fernandez
 
PDF
Metrics & more
Stefan Thies
 
PPT
Log4j Logging Mechanism
Kunal Dabir
 
PPTX
ヘルスケア業界は ランサムウェア攻撃のターゲット
Progress
 
PDF
3 d pie chart circular with hole in center 10 stages style 3 powerpoint diagr...
SlideTeam.net
 
PPSX
Mãe... lê pra mim! luiz poeta
Luzia Gabriele
 
PDF
Centenario de la escuela de telegrafía.
victoriacrespog
 
PPSX
Olhar sofrido josé ernesto ferraresso
Luzia Gabriele
 
PPTX
[Desconf 2015] Oito traços que levam o profissional ao sucesso
Guilherme Motta
 
PPTX
Gard Titlestad, EDEN Porto June 2012
icdeslides
 
PPSX
Novena de nossa senhora da aparecida o rosto misericordioso de maria
Luzia Gabriele
 
PPSX
Mãe, pedimos a tua bênção josé ernesto ferraresso
Luzia Gabriele
 
DOC
YvonneTan_Resume[1]
Yvonne Tan
 
PPTX
Scaling a Start-up DevOps team to 10x while scaling the system 50x
Stefan Zier
 
PDF
Beyond JSON with FlatBuffers
Maxim Zaks
 
PDF
Qaziya-e-Shaheed-e-Insaniyat Number
Jamal Mirza
 
PPT
Startegy management
guest24a4f12
 
DOC
Retail Warehouse Manager Resume Sample
Adriana Clarke
 
PPT
Infecciones bacterianas durante la gestación
UDmatronas Virgen del Rocio
 
Log Analysis @ Outsmart Games
Nathan Smith
 
Shipping your logs to elk from mule app/cloudhub part 1
Alex Fernandez
 
Metrics & more
Stefan Thies
 
Log4j Logging Mechanism
Kunal Dabir
 
ヘルスケア業界は ランサムウェア攻撃のターゲット
Progress
 
3 d pie chart circular with hole in center 10 stages style 3 powerpoint diagr...
SlideTeam.net
 
Mãe... lê pra mim! luiz poeta
Luzia Gabriele
 
Centenario de la escuela de telegrafía.
victoriacrespog
 
Olhar sofrido josé ernesto ferraresso
Luzia Gabriele
 
[Desconf 2015] Oito traços que levam o profissional ao sucesso
Guilherme Motta
 
Gard Titlestad, EDEN Porto June 2012
icdeslides
 
Novena de nossa senhora da aparecida o rosto misericordioso de maria
Luzia Gabriele
 
Mãe, pedimos a tua bênção josé ernesto ferraresso
Luzia Gabriele
 
YvonneTan_Resume[1]
Yvonne Tan
 
Scaling a Start-up DevOps team to 10x while scaling the system 50x
Stefan Zier
 
Beyond JSON with FlatBuffers
Maxim Zaks
 
Qaziya-e-Shaheed-e-Insaniyat Number
Jamal Mirza
 
Startegy management
guest24a4f12
 
Retail Warehouse Manager Resume Sample
Adriana Clarke
 
Infecciones bacterianas durante la gestación
UDmatronas Virgen del Rocio
 
Ad

Similar to Logging & Metrics with Docker (20)

PDF
Logging for Production Systems in The Container Era
Sadayuki Furuhashi
 
PDF
Like loggly using open source
Thomas Alrin
 
PDF
Introduction to Apache Beam
Jean-Baptiste Onofré
 
PDF
StorageQuery: federated querying on object stores, powered by Alluxio and Presto
Alluxio, Inc.
 
PPTX
Using Sumo Logic - Apr 2018
Sumo Logic
 
PPTX
Rit 2011 ats
Leif Hedstrom
 
ODP
Android porting for dummies @droidconin 2011
pundiramit
 
PDF
App container rkt
Xiaofeng Guo
 
PDF
Server(less) Swift at SwiftCloudWorkshop 3
kognate
 
PPT
Where's the source, Luke? : How to find and debug the code behind Plone
Vincenzo Barone
 
PDF
.NET @ apache.org
Ted Husted
 
PPTX
Monitoring.pptx
Shadi Akil
 
PPT
Managing Your Runtime With P2
Pascal Rapicault
 
PDF
Before & After Docker Init
Angel Borroy López
 
PPT
What's new in p2 (2009)?
Pascal Rapicault
 
PDF
Plugin-based software design with Ruby and RubyGems
Sadayuki Furuhashi
 
PPTX
Unify logz with fluentd
Soluto
 
PPTX
GOSIM 2024 - Porting Servo to OpenHarmony
GOSIM Foundation
 
PDF
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
PPT
Logging Services for .net - log4net
Guo Albert
 
Logging for Production Systems in The Container Era
Sadayuki Furuhashi
 
Like loggly using open source
Thomas Alrin
 
Introduction to Apache Beam
Jean-Baptiste Onofré
 
StorageQuery: federated querying on object stores, powered by Alluxio and Presto
Alluxio, Inc.
 
Using Sumo Logic - Apr 2018
Sumo Logic
 
Rit 2011 ats
Leif Hedstrom
 
Android porting for dummies @droidconin 2011
pundiramit
 
App container rkt
Xiaofeng Guo
 
Server(less) Swift at SwiftCloudWorkshop 3
kognate
 
Where's the source, Luke? : How to find and debug the code behind Plone
Vincenzo Barone
 
.NET @ apache.org
Ted Husted
 
Monitoring.pptx
Shadi Akil
 
Managing Your Runtime With P2
Pascal Rapicault
 
Before & After Docker Init
Angel Borroy López
 
What's new in p2 (2009)?
Pascal Rapicault
 
Plugin-based software design with Ruby and RubyGems
Sadayuki Furuhashi
 
Unify logz with fluentd
Soluto
 
GOSIM 2024 - Porting Servo to OpenHarmony
GOSIM Foundation
 
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
Logging Services for .net - log4net
Guo Albert
 
Ad

Recently uploaded (20)

PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Home Cleaning App Development Services.pdf
V3cube
 
PPTX
Essential Content-centric Plugins for your Website
Laura Byrne
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Linux schedulers for fun and profit with SchedKit
Alessio Biancalana
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Home Cleaning App Development Services.pdf
V3cube
 
Essential Content-centric Plugins for your Website
Laura Byrne
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Linux schedulers for fun and profit with SchedKit
Alessio Biancalana
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 

Logging & Metrics with Docker

  • 1. Logging & Metrics With Docker A Comprehensive Monitoring Solution Stefan Zier June 13th, 2015
  • 2. whoami Infrastructure, Backend Dev/Architect Chief Architect, Sumo Logic, since 2010 Server & Infrastructure, ArcSight (HP), 2001-2010
  • 3. Mandatory Slide Showing Shipping Containers
  • 4. Docker – What’s making debugging hard? One more layer of abstraction Container per app = File system per process File systems short lived, transient Resource schedulers = no container affinity to host
  • 5. What Our Customers Are Telling Us We have one process per container We like to log to stdout We have multiple processes per container We run the Sumo Logic collector on the Docker host We are looking into using Beanstalk with Docker We are using Amazon ECS Everyone here loves Docker We are logging straight from the application We are using /dev/log for Syslog We want immutable infrastructure
  • 6. Goal Get logs from our containerized applications to a centralized logging platform.
  • 7. How do apps emit logs Append to a file Use syslog() Use log4j, log4net, slf4, etc. printf() to stdout
  • 8. Getting logs out of the container - Files Use VOLUME to mount a host directory Collect files from the host Collect files from another container sharing the VOLUME Need to manage disk space, i.e. rotate logs App (where supported) Host Yet another container with logrotate
  • 10. docker run -v /tmp/clogs:/tmp/clogs -d --name="sumo-logic-collector" sumologic/collector:latest-file [Access ID] [Access key]
  • 11. Getting logs out - Syslog VOLUME /dev/log from host and use host syslogd Run a syslogd inside the container Emit TCP/UDP Write to a file using VOLUME Emit syslog TCP/UDP directly from the app
  • 13. docker run -d -p 514:514 -p 514:514/udp --name="sumo-logic-collector” sumologic/collector:latest-syslog [Access ID] [Access key]
  • 14. Getting logs out – Logging frameworks Sumo Logic blog on official collector images http://www.sumologic.com/blog/company/an-official-docker-image-for- the-sumo-logic-collector https://github.com/SumoLogic/sumologic-collector-docker Rainer Gerhards on Rsyslog’s file input module http://www.slideshare.net/rainergerhards1/using-wildcards-with- rsyslogs-file-monitor-imfile OWASP Log Injection https://www.owasp.org/index.php/Log_injection
  • 15. Getting logs out – Logging frameworks Directly to network destinations HTTP/HTTPS Also support files, stdout, etc.
  • 17. Getting logs out – Logging frameworks Various application stacks http://help.papertrailapp.com/ Log4J https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html Apache Web Server http://httpd.apache.org/docs/trunk/mod/mod_syslog.html https://raymii.org/s/snippets/Apache_access_and_error_log_to_syslog.html Nginx http://nginx.org/en/docs/syslog.html Postgres http://www.postgresql.org/docs/9.1/static/runtime-config-logging.html Sumo Logic blog on official syslog collector image http://www.sumologic.com/blog/company/an-official-docker-image-for-the-sumo-logic-collector https://github.com/SumoLogic/sumologic-collector-docker
  • 18. Getting logs out – stdout Simply printf() Logging framework to console Symlink to /dev/stdout or /dev/stderr Configure paths to /dev/stdout or /dev/stderr RUN ln -sf /dev/stdout /var/log/nginx/access.log RUN ln -sf /dev/stderr /var/log/nginx/error.log
  • 20. What Docker provides Captures stdout/stderr Feeds it to logging drivers docker logs command Returns the entire log every time Works with json-file driver only Can tail logs docker logs –tf –-tail 0 [ID]
  • 21. Docker Logging Drivers Configured on docker run stdout and stderr dispatched to drivers json-file (default pre 1.6) syslog journald No stats, no events json-file driver Output unbounded, can fill up the host disk Requires logrotate on the Docker host https://github.com/docker/docker/issues/7333
  • 22. Stats
  • 23. Docker Stats Per-container cgroups metrics (like docker stats) Memory CPU Block I/O CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O collector 2.23% 232.6 MiB/2 GiB 11.36% 191.9 KiB/636.3 KiB
  • 24. Requirements How would we want it to work?
  • 25. What information do we want to collect? Timestamp Log message Docker host info Container ID Image ID Process ID
  • 26. How should it work? Use docker logging infrastructure Minimal moving parts Containerized - don’t touch the host Complete – pick up all available data Automatically discover new containers
  • 28. Docker API Docker daemon has a REST API TCP or unix socket Streaming APIs Docker Events (container lifecycle updates) Container Stats (CPU, memory used, …) App Logs (container stdout/stderr)
  • 29. Collecting via Docker API Discover new containers via events Start streaming their logs and stats When they go away, stop Do all of this via the API Send all of it to centralized log management
  • 30. Collecting via Docker API, continued Single component to do it Zero footprint on the host Follows Docker standard way of logging
  • 33. Sumo Logic Docker Source Active development Early access expected later this year

Editor's Notes

  • #22: Introduced in Docker 1.6
  • #29: Introduced in Docker 1.6
  • #30: Introduced in Docker 1.6
  • #31: Introduced in Docker 1.6
  • #34: Introduced in Docker 1.6