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

ログ・係数集約と可視化・分析

 ログ・係数集約と可視化・分析

Fluentd,Embulk,ElasticStack6.0

Shuhei Ozawa

April 26, 2018
Tweet

More Decks by Shuhei Ozawa

Other Decks in Technology

Transcript

  1. Fluentdͱ͸ — ʮCNCF(Cloud Native Computing Foundation)ʯͷ؅ཧ͢ΔϓϩδΣΫτ — Kubernetes ΍ Prometheus

    ͱ͍ͬͨΫϥ΢υωΠςΟϒͳ OSS ٕज़ͷਪਐΛߦ͏ஂମ — Kubernetes؀ڥʹ͓͚Δϩάऩूπʔϧͷ ඪ४ ͱͳͬͨ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 4
  2. Fluentdͱtd-agent — Fluentd — ࠷৽όʔδϣϯ͸v1.1.3 - 2018/04/03 — FluentdͷίΞιϑτ΢ΣΞ —

    ϓϥάΠϯ͸ݸผʹར༻ऀଆͰΠϯετʔϧ — ࠷৽Λࢼ͍ͨ͠৔߹͸FluentdຊମΛ࢖͏ — td-agent — Fluentdʹ֤छϓϥάΠϯ΍Ruby؀ڥΛ૊ΈࠐΜͩύοέʔδ — ओཁ؀ڥͰgemίϚϯυʹΑΔΠϯετʔϧ͕Մೳ — Linux΁ͷΠϯετʔϧ΋༰қ — αϙʔτOSʹ੍໿͕͋Δ͕ґଘؔ܎ͷ໰୊͕΄΅ͳ͠ — τϨδϟʔσʔλଆͰݕূࡁͳͷͰຊ൪ɺ҆ఆՔಇ͕͍͍ͷ͸td-agent ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 5
  3. ඇಉظϝοηʔδϯάαʔϏεQoS ωοτϫʔΫ্Ͱఏڙ͢ΔػೳΛ҆ఆతʹՔಇͤ͞ΔͨΊʹߦ͏ɺαʔϏε඼࣭؅ཧٕज़ At Most Once(σϑΥϧτ) At Least Once(Φϓγϣϯ) Exactly Once(αϙʔτ͞Ε

    ͍ͯͳ͍) ౸ୡอূͳ͠ ౸ୡอূ͋Γ ౸ୡอূ͋Γ ౤͛Δଆ͕Ұ౓Ͱ౤͛Δ͜ͱ ౤͛Δଆ͕Ұ౓Ͱ౤͛Δ͜ͱ ౤͛Δଆɺड͚औΔଆͱ΋ʹ Ұ౓Ͱ഑৴͞ΕΔ͜ͱ ܽଛͷՄೳੑ͋Γ ܽଛ͠ͳ͍ ܽଛ͠ͳ͍ ॏෳ͠ͳ͍ ॏෳͷՄೳੑ ॏෳ͠ͳ͍ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 8
  4. v0.12όʔδϣϯ old stable - ϓϥάΠϯ: Input, Parser, Filter, Output, Formatter,Buffer

    - ҎԼͷΑ͏ͳ໰୊͕͋Δ - ඵ୯ҐͷΈ - windowsະରԠ - multi coreະରԠ - ϓϥάΠϯ͕ශऑ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 9
  5. v0.14Ҏ߱ͷόʔδϣϯ v0.14 v1ͷ։ൃόʔδϣϯ - ϓϥάΠϯ: Input, Parser, Filter, Output, Formatter,

    Storage, Buffer - վળ఺ - New Plugin APIs - ϛϦඵରԠ - windowsରԠ - multi coreରԠ - New Plugin Helpers & Plugin Storage ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 10
  6. v0.12ͱv1 — v0.12 APIΛ࢖༻͢ΔϓϥάΠϯ͸ɺFluentd v0.14ͱv1ͷؒͰαϙʔτ͞Ε Δʢv2Ͱഇࢭ͞ΕΔ༧ఆʣ — Fluentd v1͸ɺىಈ࣌ʹࣗಈతʹv0.12ελΠϧΛv1.0ελΠϧʹม׵͢Δ ͷͰɺv0.12ͷઃఆΛv1Ͱ࠶ར༻Մೳ

    — Fluentd v1.0ͷ৽ػೳ͸ɺ৽͍͠APIΛ࢖༻͢ΔϓϥάΠϯͰͷΈ࢖༻Մೳ — flexible chunk keys — placeholders — Fluentd v0.12.xͰ͸৽͍͠APIΛ࢖༻͢ΔϓϥάΠϯ͸ಈ࡞͠ͳ͍ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 12
  7. v0.12ͱv1ͷઃఆͷҧ͍ v1͸outputͷόοϑΝύϥϝʔλʹ<buffer>sectionΛ࢖͍ͬͯΔ # v1 <match pattern> @type foo database db1

    apikey foobarbaz # buffer parameters <buffer> @type file path /path/to/buffer flush_interval 10s </buffer> </match> # v0.12 <match pattern> @type foo database db1 apikey foobarbaz # buffer parameters buffer_type file buffer_path /path/to/buffer flush_interval 10s </match> ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 13
  8. fluent-plugin-bigquery(v.1.2.0)ͷoutbigqueryinsert.rb def insert(project, dataset, table_id, rows, schema, template_suffix) writer.insert_rows(project, dataset,

    table_id, rows, template_suffix: template_suffix) rescue Fluent::BigQuery::Error => e if @auto_create_table && e.status_code == 404 && /Not Found: Table/i =~ e.message # Table Not Found: Auto Create Table writer.create_table(project, dataset, table_id, schema) raise "table created. send rows next time." end raise if e.retryable? if @secondary # TODO: find better way @retry = retry_state_create( :output_retries, @buffer_config.retry_type, @buffer_config.retry_wait, @buffer_config.retry_timeout, forever: false, max_steps: @buffer_config.retry_max_times, backoff_base: @buffer_config.retry_exponential_backoff_base, max_interval: @buffer_config.retry_max_interval, secondary: true, secondary_threshold: Float::EPSILON, randomize: @buffer_config.retry_randomize ) else @retry = retry_state_create( :output_retries, @buffer_config.retry_type, @buffer_config.retry_wait, @buffer_config.retry_timeout, forever: false, max_steps: 0, backoff_base: @buffer_config.retry_exponential_backoff_base, max_interval: @buffer_config.retry_max_interval, randomize: @buffer_config.retry_randomize ) end raise end ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 15
  9. Fluentd v1.2ʹ͸retryͷڍಈ͕มΘΓͦ͏ɻ Fluentdͷoutput olugin͸ɺchunk flushதʹ෮ؼෆՄೳͳΤ ϥʔΛൃੜ͢Δ͕ɺ ͜ΕΒͷνϟϯΫΛॲཧ͢ΔͨΊʹ retry limit ͱ

    secondary Λ࢖͍ͬͯΔɻ — ࠶։࣌ʹഁଛͨ͠filechunkΛskipͯ͠࡟আ https://github.com/fluent/fluentd/pull/1874 — chunkͷflushதʹoutput plugin͕ճ෮ෆՄೳͳΤϥʔΛ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 16
  10. όοϑΝઃܭ(v0.12) — ࠷ॳʹ৘ใ͕ೖͬͯ͘ΔBufferͱ͍͏ػೳͷ࠷େαΠζ: buffer_chunk_limit — ࣍ʹQueueͱ͍͏෦෼ʹchunk͕ԡ͠ग़͞ΕΔ͕QueueͰԿݸ·ͰchunkΛ஝͑ΒΕΔ͔: buffer_queue_limit — enqueue: buffer_chunk_limit

    Λ௒͑ͨ৔߹ԡ͠ग़͞ΕΔ৔߹ͱ flush_interval Λܦաͨ͠৔߹౉͞ΕΔέʔε — ͦΕͧΕઃఆ͢Ε͹ॊೈʹϩάΛૹΔ͜ͱ͕Ͱ͖Δ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 18
  11. όοϑΝઃܭ(v0.12) — Outputͷύϥϝʔλ ύϥϝʔλ ಺༰ buffer_type όοϑΝͷछྨ(file,memory) buffer_path ϑΝΠϧόοϑΝͷ֨ೲઌ bufferchunklimit

    chunck࠷େαΠζ bufferqueuelimit Queue಺chunck࠷େ਺ flush_interval όοϑΝϑϥογϡִؒ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 19
  12. όοϑΝઃܭ(v0.12) <match access.**> @type forward buffer_type file buffer_path /var/log/td-agent.buffer buffer_chunk_limit

    8m #8MBΛอ࣋͢Δ buffer_queue_limit 64 #64ݸ·Ͱ஝͑Δ flush_interval 60s # Buffer͔ΒQueueʹ౉͞ΕΔ৔߹60ඵͨͬͨΒத਎ͷchunckΛQueueʹ౉͢ <server> name test_server host 192.168.33.11 port 24224 </server> </match> ஝͑ΔDiskͷ༰ྔ΍ϝϞϦͷαΠζ͸ɹbuffer_chunk_limit x buffer_queue_limit Λ͔͚߹Θͤͨ΋ͷ͕ྖҬͱͯ͠BufferͷαΠζͱͯ͠ඞཁʹͳΔ matchͷ਺͚ͩ͜ͷ͔͚߹Θͤͨ஋͕ඞཁʹͳΔͷͰ஫ҙ͕ඞཁɻ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 20
  13. FluentdͱEmbulkͷ࢖͍෼͚ — Fluentd — WEB/APPαʔόͷϩάऩू — ؂ࢹɺϞχλϦϯά — ྲྀྔͷେ͖͍ϩάऩू —

    ϦΞϧλΠϜੑͷߴ͍෼ੳ༻్ — όονͰཷΊࠐΉͱૹΕͳ͍΋ͷ — Embulk — Ϛελσʔλͷಉظ — Ұ೔͝ͱͷσʔλҠಈ(όονత) — S3ͳͲ͔Βͷฒྻσʔλμ΢ϯϩʔυ — DWH΁ͷσʔλϩʔυ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 25
  14. όʔδϣϯ 0.9.0 (2018-01-30) - Java 8 - Lambda - Stream

    - Time - Async File IO - FileSystem - Oracle Java SEαϙʔτɾϩʔυϚοϓ - LTS όʔδϣϯ͕ɺ3೥͝ͱͷϦϦʔεΛ໨ඪ - ػೳϦϦʔε͸ɺ6ϲ݄͝ͱΛ໨ඪ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 26
  15. ֤ίϯϙʔωϯτͷ໾ׂ — Elasticsearch ͢΂ͯͷσʔλΛ֨ೲ͠ɺݕࡧػೳͱ෼ੳػೳΛεέʔϥϒϧʹఏڙ — Logstash ϩάɺϝτϦοΫͳͲͷΠϕϯτσʔλΛ೚ҙͷܗࣜͰूத؅ཧ — Beats Filebeat͸ɺαʔόʔ͔ΒLogstash΍ElasticsearchʹϩάϑΝΠϧΛ഑৴͢ΔͨΊʹߏங͞ΕͨBeat

    Metricbeat͸ɺαʔόʔ্Ͱ࣮ߦ͞Ε͍ͯΔOS΍αʔϏε͔ΒఆظతʹϝτϦοΫΛऩू͢Δαʔό ʔ؂ࢹΤʔδΣϯτ — kibana Elastic Searchͷࢹ֮Խπʔϧ — X-Pack Elastic StackʹηΩϡϦςΟɺ؂ࢹɺΞϥʔτɺϨϙʔτɺ͓ΑͼάϥϑػೳΛ௥Ճ ίʔυ͕ެ։ɻ ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 30
  16. ͓໾ཱͪ৘ใ·ͱΊ — Fluentd Fluentd v1 and future at techtalk ϓϥάΠϯ։ൃऀ͔ΒݟΔfluentd

    v1.0ͷ׆༻๏ fluentd ͷجૅ஌ࣝ — Embulk Embulk v0.9 Embulk — Bigdam Bigdam — ElasticStack discuss.elastic.co ϓϩμΫτษڧձ 2018/04/23 - Ozawa Shuhei 31