docker logs -f

84907687e50c8ac2a09b02e0d1b36ab1?s=47 Tori
March 05, 2016

docker logs -f

tail -f で流れてくるログを見るのが大好きです

84907687e50c8ac2a09b02e0d1b36ab1?s=128

Tori

March 05, 2016
Tweet

Transcript

  1. $ docker logs -f Yasuhiro HARA Docker Meetup Tokyo #6

  2. Yasuhiro HARA / toricls

  3. 1. 開発環境の Docker ログの話 2. 本番環境の Docker ログの話

  4. $ docker logs -f gulp [13:58:04] Using gulpfile /app/gulpfile.js [13:58:04]

    Starting 'default'... ひと昔前の開発環境ログ その1
  5. $ cat Procfile web: docker logs -f web api: docker

    logs -f api ひと昔前の開発環境ログ その2 https://github.com/ddollar/forego $ cat Procfile web: docker logs -f web api: docker logs -f api $ ./forego start | grep 'error' web.1 | 2016/03/03 15:25:35 [error] 19997#0: *1 open() "/var/www/ html/something.php" failed (2: No such file or directory), client: 192.168.8.1, server: localhost, request: "GET /something.php HTTP/1.1", host: "www.example.com" api.1 | ERROR: 2016/03/04 13:57:59[service] Failed to fetch some data
  6. $ docker-compose logs Attaching to db, gulp, api, web gulp

    | [13:58:04] Using gulpfile /app/gulpfile.js api | INFO: 2016/03/04 13:57:59[service] listening on port 9000 db | 2016-03-04 13:58:05 mysqld (mysqld 5.6.29) starting as process 1 ... web | INFO: 2016/03/04 13:59:59 [192.168.99.1:65446] 200 GET / 0.645 web | INFO: 2016/03/04 13:59:59 [192.168.99.1:65446] 200 GET / 0.645 開発環境の Docker ログ $ docker-compose logs | grep 'error' web | 2016/03/03 15:25:35 [error] 19#0: *1 open() "/app/ something.php" failed (2: No such file or directory), client: 192.168.8.1, server: localhost, request: "GET /something.php HTTP/1.1", host: "www.example.com" api | ERROR: 2016/03/04 13:57:59[service] Failed to fetch some data
  7. $ docker-compose logs Attaching to db, gulp, api, web gulp

    | [13:58:04] Using gulpfile /ap gulpfile.js api | INFO: 2 list 本番環境で͸ʁ
  8. ガテン系本番環境ログ ssh user@host docker logs -f hoge

  9. ひと昔前の本番環境ログ その1 forward -v /host/dir:/app/logs

  10. ひと昔前の本番環境ログ その2 forward bundled fluentd

  11. ちょっと前の本番環境ログ forward -v /var/lib/docker/containers :/var/lib/docker/containers https://github.com/bwalex/fluent-plugin-docker-format

  12. 最近の本番環境ログ logging-driver

  13. logging-driver $ docker run -d -p 80:80 \ --log-driver=fluentd \

    --log-opt fluentd-address=fluentd.host:24224 \ --log-opt tag=docker.{{.Name}} \ my/web
  14. ड͚औΔͷ΋؆୯ 13 MB!!

  15. forwarded ϩάແ૒

  16. Thank you :)