SlideShare a Scribd company logo
     Fluentd
        in
    Fluentd  meetup  in  Fukuoka
                2013/03/07
                   @Spring_MT
Profile
 twitter : @Spring_MT
 Company : 10xLab
 Engineer
Agenda
Fluentd
in Co-Work app
in Co-Work infra
Fluentd in Co-Work
SNS for Companies
(like Yammer)
During Closed β
Fluentd in Co-Work
Infra
Architecture
10xlab  Infra
ALL AWS!
Use VPC
Ruby, Fluentd and Chef
in all servers
 gem install fluentd
f   fluentd
        public

                  subnet
                  net work

                         Gateway                     NAT
                                      SSLの変換


    subnet                                                                     subnet         subnet
    utility         subnet                                                     fluentd        storage
                    Co-Work                                            deliver           proxy
                   APP
Watch
                                                                       f                 f
                                                               redis
                    f             f              f
                                                                       worker            varnish
f                DB(MySQL on EC2)                          f                                +
                                                                                         sinatra


                          f              f                                 f
                                                      worker                              f


                              f              f             f
Co-Work
WAF
 Ruby on Rails
DB
 MySQL on EC2
KVS
 redis
Fluentd
     in
Co-Work  App
App
Queuing
Logging
Queuing
Queuing
Resque
 Ruby based job queue
 liblary using github
 Multiprocessing
 Backend is redis

https://github.com/defunkt/resque
fluent-plugin-resque
 Fluentd output plugin
 for sending resque-
 queue to redis

 https://github.com/hotchpotch/fluent-
 plugin-resque
Why  Fluentd?
worker
      worker
app   worker
      worker

               r   r   queue
               e   e   worker
      worker
      worker   s   s
app   worker   q   q
      worker
               u   u   queue
               e   e   worker
      worker
      worker
app   worker
      worker
worker

       worker
app
       worker

       worker
                X
           If queing fail,
      App should retry queuing.


       You write a retry
          processing?
worker
      worker
app   worker   f   f
      worker   l   l
               u   u
               e   e   r   queue
               n   n   e   worker
      worker   t   t
      worker   -   -   s
app   worker   l   r   q
      worker   o   e   u   queue
               g   s
               g   q   e   worker
      worker   e   u
      worker   r   e
app   worker
      worker
worker

app
      worker
      worker
               X   X
      worker




  If queuing fail,
  Fluentd retry queuing !
  Fluentd(and Logger)
   Buffering internally
   Retrying
Send  Queue  
Data  to  Fluentd
Fluentd in Co-Work
Send  Resque-
Queue  to  Redis
Fluentd in Co-Work
BreaK



http://photo.v-colors.com/2111.html
Logging
Logging
Access log(nginx)
PV log(rails)
 Ref. WEB†DB PRESS vol.
App Log(rails)
Why  Fluentd?
Log  File
Transfer
 Forwarding server is full
 m9(^Д^)プギャー

 Operate transfer script?
 Real-Time analysis ?
 Delete log file
Log  File
Format and Analysis
 Disjointed format
 (CSV? TSV? LTSV? JSON?)
 Operate analysis script?
Fluentd
Unified Format(JSON)
Real-Time transfer and
High Availability
Easy Setup and Easy
extension
Well Tested At Big
services(○HN, ○ookpad)
Just  Do  It  !



  http://d.hatena.ne.jp/tagomoris/20121029/1351491111
Just  Do  It  !

                      し ょ
今 で
  http://d.hatena.ne.jp/tagomoris/20121029/1351491111
access
proxy     log
             in_tail
                            deliver     S3

                  in_tail
        PV log
                                       Growth
 app
        app log   logger              Forecast
Analysis
copy
 out_route
 fluent-plugin-rewrite-tag-filter

analysis
 fluent-plugin-datacounter
 fluent-plugin-numeric-counter
 fluent-plugin-numeric-monitor
 fluent-plugin-amplifier-filter
Output
GrowthForecast
 fluent-plugin-growthforecast
 For visualize data


GrowthForecast
 Web API for
 drawing graph
 Perl
Fluentd in Co-Work
Fluentd in Co-Work
Treasure  Data
fluent-plugin-td
For data analysis
(mainly access log)

TreasureData
 Hadoop-based data
 store and
 analysis service
Fluentd in Co-Work
S3
fluent-plugin-s3
For backup logs


S3
 Data Store
 Service in AWS
 Eleven Nine
ikachan
  fluent-plugin-ikachan
  IRC notification(Ex.fatal log)

ikachan
 Web API
 for IRC
 Perl
Fluentd in Co-Work
Analysis  in  TD
SQL Like
500 GB ($299/M)
Analysis using Ruby!
Fluentd in Co-Work
Fluentd in Co-Work
Fluentd in Co-Work
Collect
  Lib
Fluentd
     in
Co-Work  Infra
Watch
For resource watch
Fluentd collect data
and push data each
notification tools.
fluent-plugin-mysqlslowquery

 Collect mysql slow
 query log
 Notify IRC through
 fluent-plugin-ikachan +
 ikachan
Fluentd in Co-Work
fluent-resque-stat
Collect Resque status
pending       キューの残数
processed     取り出したキューの総数
queues        登録されてるキューの名前の総数
workers       キューを取り出すworkerの数
working       キューを処理中のworker数
failed        失敗したキュー数
servers       resqueが動いてるサーバーのhostやportの情報
              resque_statが動いているサーバーの RAILS_ENV or
environment
              RACK_ENV(なければdevelopmentが入る)
fluent-resque-stat
Thank  You  !
Fluentd
 Setup
Install  and  Setup
Installattion of
Fluentd is AWS cloud-
init(user_data)
Setting Fluentd is
chef-sole and
capistrano
I Extend a little above system
for specifying cookbook.
$ cap -S subnet=fluentd -S hosts=xfdeliver001 chef
Launch  and  
Monitoring  Process
supervisor

More Related Content

Fluentd in Co-Work