Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Docker Logging Best
Practices
1
# ========
# who am i
# ========
Initialized Thurs Sept 14, 07:00:12 JST
[INFO] Name: Chew Esmero
[PASS] Works at Mobingi
...
Considerations when logging with Docker
• Containers are transient

• They are started, stopped, destroyed, rebuilt
consta...
Logging design considerations (1)
• Categorize Docker logs

• Infrastructure logs

• Docker engine, infra services, host

...
Logging design considerations (2a)
• Define organizational ownership

Example 1

Category Team
Infrastructure logs Infra te...
Logging design considerations (2b)
• Define organizational ownership

Example 2 (if organization is larger)

Category Team
...
Logging design considerations (2c)
• Define organizational ownership

Example 3 (small organization)

Category Team
Infrast...
Logging design considerations (3)
• Pick a logging solution that:

• allows for the implementation of ownership in
previou...
Best practices (1)
• If you already have logging infra in place, then you should
use the logging driver for that existing ...
Best practices (2a)
• If you don’t have an existing logging system, here are
some supported drivers:

10
Driver Advantages...
• If you don’t have an existing logging system, here are
some supported drivers:

• If log data is highly sensitive, syslo...
Best practices (3)
• Ideally, let applications log to STDOUT/STDERR and let
Docker send the logs to the configured destinat...
Demo
13
Presentation repository
https://github.com/flowerinthenight/20170914-tokyo-
mastercloud-presentation

14
Upcoming SlideShare
Loading in …5
×

Docker Logging Best Practices

686 views

Published on

Presentation file during MasterCloud meetup on Sept. 14, 2017 in Tokyo, Japan. The demo app can be downloaded from https://github.com/flowerinthenight/20170914-tokyo-mastercloud-presentation.

Published in: Technology
  • Be the first to comment

Docker Logging Best Practices

  1. 1. Docker Logging Best Practices 1
  2. 2. # ======== # who am i # ======== Initialized Thurs Sept 14, 07:00:12 JST [INFO] Name: Chew Esmero [PASS] Works at Mobingi [FAIL] Nihongo is not very good [WARN] - [INFO] github.com/flowerinthenight [WARN] - [INFO] background: [WARN] - drivers [WARN] - embedded [WARN] - kernel [WARN] - c/c++/asm 2
  3. 3. Considerations when logging with Docker • Containers are transient • They are started, stopped, destroyed, rebuilt constantly. • Containers are multi-tiered • Even the simplest installations, there are 3 levels: 1. Docker container 2. Docker service 3. Host OS 3
  4. 4. Logging design considerations (1) • Categorize Docker logs • Infrastructure logs • Docker engine, infra services, host • Usually limited to STDOUT/STDERR • Application logs • Could be STDOUT/STDERR + custom logs 4
  5. 5. Logging design considerations (2a) • Define organizational ownership Example 1 Category Team Infrastructure logs Infra team Application logs Application ops 5
  6. 6. Logging design considerations (2b) • Define organizational ownership Example 2 (if organization is larger) Category Team Docker engine logs Infra team Infra services logs Infra team Application A logs Application A ops Application B logs Application B ops 6
  7. 7. Logging design considerations (2c) • Define organizational ownership Example 3 (small organization) Category Team Infrastructure logs Infra team Application logs Infra team 7
  8. 8. Logging design considerations (3) • Pick a logging solution that: • allows for the implementation of ownership in previous examples. • you are most familiar with (very important) • has Docker integration: stable Docker plugin, good documentation, etc. 8
  9. 9. Best practices (1) • If you already have logging infra in place, then you should use the logging driver for that existing infrastructure, if available. 9
  10. 10. Best practices (2a) • If you don’t have an existing logging system, here are some supported drivers: 10 Driver Advantages Disadvantages json-file Default, supports docker logs. Logs resides locally, not aggregated, can fill up disk if no restrictions. syslog Supported in most machines. The only driver that supports TLS. Needs to be setup as highly available (HA). journald Works with docker logs. Can be down without impact. Binary format so needs extra steps to send to collector. gelf Indexable fields. Support tags. No docker logs support. fluentd Provides container_name and container_id by default. No docker logs support for local logs. awslogs Easy integration with Amazon Web Services. Not ideal for hybrid cloud or on-premise. No docker logs support. splunk Easy integration with Splunk, tags support, additional metrics. Needs to be highly available. No docker logs support. etwlogs Common in Windows. Indexable by default. Only works on Windows. gcplogs Simple integration with Google Compute. Not ideal for hybrid cloud or on-premise. No docker logs support.
  11. 11. • If you don’t have an existing logging system, here are some supported drivers: • If log data is highly sensitive, syslog and splunk are good options. • gelf and fluentd are a good choice if there is a NoSQL db where logs can be stored. • For development of test, json-file or journald are good choices. Best practices (2b) 11
  12. 12. Best practices (3) • Ideally, let applications log to STDOUT/STDERR and let Docker send the logs to the configured destination. 12
  13. 13. Demo 13
  14. 14. Presentation repository https://github.com/flowerinthenight/20170914-tokyo- mastercloud-presentation 14

×