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

はてなのログ運用 これまでとこれから / Hatena Engineer Seminar #6

tatsuru
August 31, 2016
12k

はてなのログ運用 これまでとこれから / Hatena Engineer Seminar #6

Hatena Engineer Seminar #6 インフラ編での発表スライドです

tatsuru

August 31, 2016
Tweet

More Decks by tatsuru

Transcript

  1. reverse proxy App server DB access log error log structured

    log syslog server storage server SSD server rsyslog aggregator
  2. ΞΫηεϩάग़ྗ • ΞΫηεϩάͷϚελͱͳΔϩάͷग़ྗ • ֤छௐࠪɺૢ࡞ϩάɺetc. • ϩʔΧϧʹϩάΛు͘@ϦόʔεϓϩΩγ • LTSV (Labeled

    Tab-separated Values) http://ltsv.org/ host:127.0.0.1 ident:- user:frank time:[10/Oct/2000:13:55:36 -0700] req:GET /apache_pb.gif HTTP/1.0 status:200 size:2326 referer:http:// www.example.com/start.html ua:Mozilla/4.08 [en] (Win98; I ;Nav)
  3. ؆୯ʹ෼ੳ͍ͨ͠ • SSDͷαʔόʹ΋ඈ͹͢ • SSD͕҆͘ͳͬͨͷͰಋೖ • ࡶଟʹ grep ΍෼ੳ •

    ΞΫηεϩά͔ΒϨΠςϯγ෼ੳ • 2೥ॻ͍ͨΒSSD͕յΕͨͷͰަ׵
  4. ΋ͬͱ؆୯ʹ෼ੳ͍ͨ͠ • S3 ͔Β Amazon EMR (ElasticMapReduce) ΁ • LTSVΛಡΈࠐΉσγϦΞϥΠβ

    
 github.com/hatena/KeyValuePairsDeserializer • SQLͰ؆୯ʹ෼ੳ select count(distinct regexp_extract(referer,"http://([^/]+)/",1)) from logs where req rlike 'GET /hoge‘
  5. ߏ଄ԽϩάΛग़͢ • શαʔϏεͰಛఆͷ path ʹ JSON Ͱు͘ • ඪ४ग़ྗɾΤϥʔग़ྗͱ͸෼͚Δ •

    ΞϓϦέʔγϣϯ͔Β໌ࣔతʹు͘ • ߦಈϩάɺDBΞΫηεɺͦͷଞͳΜͰ΋
  6. fluentdͰ഑ૹ • ֤ϗετͰ in_tail +out_forward Ͱඈ͹͚ͩ͢ • ͜͜͸΄ͱΜͲ͍͡Βͳ͍ • தԝͷ

    aggregator ʹ౉ͯ͠Α͠ͳʹॲཧ • ඼࣭͸ϕετΤϑΥʔτ • ඞཁͳ৔ॴʹ͸ผ్อূͨ͠࢓૊ΈΛཱͯΔ • ͍ͭͰʹϦόʔεϓϩΩγ͔Β΋ૹΓ࢝ΊΔ
  7. reverse proxy App server DB access log error log structured

    log syslog server storage server SSD server rsyslog aggregator
  8. ࣭ٙɾTwitterΑΓ • fluentd aggregator ٧·Γ·ͤΜ͔ • aggregator ͷઌʹɺͦΕͧΕͷσʔλετΞ͝ ͱʹ fluentd

    Λཱͯͯอଘ͍ͯ͠·͢ • ͜͏͢Δ͜ͱͰӨڹΛσʔλετΞ୯ҐʹہॴԽ ͍ͯ͠·͢