Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GKEでは
StackDriver Loggingに
どうやってログを送っているか

GKEでは
StackDriver Loggingに
どうやってログを送っているか

2017/08/08 Kubernetes Meetup Tokyo #6 LT発表資料
GKEではStackDriver Loggingにどうやってログを転送しているか・StackDriver Loggingへのログの転送方法について発表しました。

Takumi Yoshida

August 08, 2017
Tweet

More Decks by Takumi Yoshida

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • ytakky2014 / ٢ా ୓࣮
 • github https://github.com/ytakky2014 •

    @y_takky2014 
 https://twitter.com/y_takky2014 • GCP / golang / PHP / CIɾCD / http://info.ytakky.tech/
  2. ೖྗ <source> type tail format json time_key time path /var/log/containers/*.log

    pos_file /var/log/gcp-containers.log.pos time_format %Y-%m-%dT%H:%M:%S.%N%Z tag reform.* read_from_head true </source>
  3. ࣮ࡍ͸ͲͷϑΝΠϧΛऩूͯ͠ ͍Δ͔ • Nodeͷ /var/log/containers/*.logʹSTDOUTʹు͔Εͨϩά͕͋Δ • ࣮ࡍͷϑΝΠϧ໊͸
 [pod໊]_[namespace]_[containerID].log • frontend-3823415956-79vzs_default_php-

    redis-83772f44edd5ee75e921c063d45b710f5053d0a2c86a5c40c3212c b48922bb2c.log • ͜ΕʹreformΛprefixͱͯ͠෇͚Δ
 reform.frontend-3823415956-79vzs_default_php-redis- 83772f44edd5ee75e921c063d45b710f5053d0a2c86a5c40c3212cb489 22bb2c.log
  4. <match raw.kubernetes.**> @type detect_exceptions remove_tag_prefix raw message log stream stream

    multiline_flush_interval 5 max_bytes 500000 max_lines 1000 </match>
  5. <match kubernetes.**> @type google_cloud # Collect metrics in Prometheus registry

    about plugin activity. enable_monitoring true monitoring_type prometheus # Set the buffer type to file to improve the reliability and reduce the memory consumption buffer_type file buffer_path /var/log/fluentd-buffers/ kubernetes.containers.buffer
 ....
  6. ·ͱΊ • STDOUTʹϩάΛམͱ͓͚ͯ͠͹ɺ
 GKEͳΒ͹ࣗಈͰStackDriverLogging΁సૹ • fluentd-pluginͷ௥Ճ΍fluentd confͷมߋʹͳΔͱखؒʹ ͳΔ • StackDriverLogging͸Exportग़དྷΔͷͰfluentdͷઃఆͰͲ

    ͏ʹ͔͍ͨ͠Θ͚Ͱ͸ແ͚Ε͹ͦͪΒΛ࢖ͬͨ΄͏͕ྑ͍
 gSlack: Integrating Google Cloud Platform with Slack
 https://blog.doit-intl.com/gslack-9391be7c191a