Fluentd	PHP	  &
@chobi_e
chobi_e	  is:	  	  PECL	  Sundown	  Author	                         (will	  be	  release	  soon)	  h>ps://github.com/chobi...
Scaling	  web	  servers.
Scaling	  web	  servers.	  basically,	  just	  add	  web	  server	  to	  the	  array.
then,	  how	  about	  collecLng	  log	  files?
using	  log	  file	  
using	  log	  file	  	                            Are	  you	  serious?
using	  syslog	  like	  middleware
using	  syslog	  like	  middleware	                                          Not	  Bad.
using	  reliable	  and	  distributed	  log	  collector:	  	Note:	  fluent-­‐logger-­‐php	  does	  not	  support	  output	  ...
using	  reliable	  and	  distributed	  log	  collector:	  	                                                               ...
fluentd	  provides	  robust	  messaging	  soluLon
for	  Data	  Mining	                          Data	  Mining
for	  queued	  job	                         Data	  Mining	                                Queued	  job
fluentd	  first	  step	  with	  PHP
install	  by	  composer
#	  composer.json	  {	  	  	  "name":	  "my-­‐project",	  	  	  "version":	  "1.0.0",	  	  	  "require":	  {	  	  	  	  	 ...
wget	  h>p://getcomposer.org/composer.phar	  php	  -­‐d	  detect_unicode=0	  composer.phar	  install
<?php	  require	  "vendor/.composer/autoload.php";	  	  use	  FluentLoggerFluentLogger;	  	  $logger	  =	  FluentLogger::o...
install	  by	  copy	  the	  tree.
git	  clone	  h>ps://github.com/fluent/fluent-­‐logger-­‐php.git	  cp	  -­‐r	  src/Fluent	  <path/to/your_project>
php	  library	  which	  using	  Fluentd.
MonologFluent	  by	  nrk	  h>ps://github.com/nrk/monolog-­‐fluent.git
what	  is	  Monolog?	  	  Monolog	  by	  Seldaek.	  h>ps://github.com/Seldaek/monolog	  	  	  Monolog	  is:	  heavily	  in...
install	  $	  wget	  h>p://getcomposer.org/composer.phar	  $	  php	  composer.phar	  install	  	  
<?php	  use	  NrkFluentMonologFluentHandler;	  	  $log	  =	  new	  MonologLogger(debug.monolog);	  	  $log-­‐>pushHandler(...
introduce	  my	  fluent	  plugin
fluent-­‐plugin-­‐delayed	  	  -­‐	  delayed	  output	  plugin.	  	  h>ps://github.com/chobie/fluent-­‐plugin-­‐delayed	  
fluent-­‐plugin-­‐delayed	  	  -­‐	  delayed	  output	  plugin.	  	  h>ps://github.com/chobie/fluent-­‐plugin-­‐delayed	    ...
other	  Ideas.	  	  fluent-­‐plugin-­‐cooldown	  	  -­‐	  coolodowned	  outputs	  when	  specified	  key	  received.	  	  flu...
GitHQ	  /	  Kokuban	  Github	  /	  gist	  clone	  (sLll	  under	  development)
updaLng	  ssh	  key	  	  is	  	  pain	  in	  ass.	/home/git/.ssh/authorized_keys
updaLng	  SSH	  Authorized	  keys	                                                                       only	  pass	  coo...
Web	  developer	  only	  knows	  tag	  for	  queued	  job.
Web	  developer	  only	  knows	  tag	  for	  queued	  job.	Server	  engineer	  only	  implements	  reliable	  consumer	  p...
Sounds	  good?
fluent-­‐logger-­‐php	  status.
fluentd	  protocol	  support	  ✔	  h>p	  protocol	  support	  ✔	  composer	  support	  ✔	  PEAR	  package	  support	  ✔	  -...
That’s	  all	  
That’s	  all	  i	  need	  more	  developer!	  please	  feel	  free	  to	  pull	  req	  me.	  	  h>ps://github.com/chobie	  
Fluentd and PHP
Upcoming SlideShare
Loading in …5
×

Fluentd and PHP

7,366 views

Published on

Published in: Technology
0 Comments
13 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,366
On SlideShare
0
From Embeds
0
Number of Embeds
103
Actions
Shares
0
Downloads
37
Comments
0
Likes
13
Embeds 0
No embeds

No notes for slide

Fluentd and PHP

  1. 1.  Fluentd PHP  &
  2. 2. @chobi_e
  3. 3. chobi_e  is:    PECL  Sundown  Author   (will  be  release  soon)  h>ps://github.com/chobie/php-­‐sundown  libgit2  PHP  Binding  Author  h>ps://github.com/libgit2/php-­‐git  phpredis  contributor  h>ps://github.com/nicolasff/phpredis  
  4. 4. Scaling  web  servers.
  5. 5. Scaling  web  servers.  basically,  just  add  web  server  to  the  array.
  6. 6. then,  how  about  collecLng  log  files?
  7. 7. using  log  file  
  8. 8. using  log  file   Are  you  serious?
  9. 9. using  syslog  like  middleware
  10. 10. using  syslog  like  middleware Not  Bad.
  11. 11. using  reliable  and  distributed  log  collector:   Note:  fluent-­‐logger-­‐php  does  not  support  output  buffering.  So  local  fluentd  as  a  buffer  in  this  case.
  12. 12. using  reliable  and  distributed  log  collector:   that’s  the  best  soluLon  IMHO Note:  fluent-­‐logger-­‐php  does  not  support  output  buffering.  So  local  fluentd  as  a  buffer  in  this  case.
  13. 13. fluentd  provides  robust  messaging  soluLon
  14. 14. for  Data  Mining Data  Mining
  15. 15. for  queued  job Data  Mining Queued  job
  16. 16. fluentd  first  step  with  PHP
  17. 17. install  by  composer
  18. 18. #  composer.json  {      "name":  "my-­‐project",      "version":  "1.0.0",      "require":  {          "fluent/logger":  "master-­‐dev"      }  }
  19. 19. wget  h>p://getcomposer.org/composer.phar  php  -­‐d  detect_unicode=0  composer.phar  install
  20. 20. <?php  require  "vendor/.composer/autoload.php";    use  FluentLoggerFluentLogger;    $logger  =  FluentLogger::open(        "debug.test",        "localhost",        "24224”  );
  21. 21. install  by  copy  the  tree.
  22. 22. git  clone  h>ps://github.com/fluent/fluent-­‐logger-­‐php.git  cp  -­‐r  src/Fluent  <path/to/your_project>
  23. 23. php  library  which  using  Fluentd.
  24. 24. MonologFluent  by  nrk  h>ps://github.com/nrk/monolog-­‐fluent.git
  25. 25. what  is  Monolog?    Monolog  by  Seldaek.  h>ps://github.com/Seldaek/monolog      Monolog  is:  heavily  inspired  by  Pythons  Logbook  library,  although  most  concepts  have  been  adjusted  to  fit  to  the  PHP  world.    
  26. 26. install  $  wget  h>p://getcomposer.org/composer.phar  $  php  composer.phar  install    
  27. 27. <?php  use  NrkFluentMonologFluentHandler;    $log  =  new  MonologLogger(debug.monolog);    $log-­‐>pushHandler(new  FluentHandler(h>p://127.0.0.1));  $log-­‐>pushHandler(new  FluentHandler(tcp://127.0.0.1));    $log-­‐>addError("OH  NOES!!11!1!");
  28. 28. introduce  my  fluent  plugin
  29. 29. fluent-­‐plugin-­‐delayed    -­‐  delayed  output  plugin.    h>ps://github.com/chobie/fluent-­‐plugin-­‐delayed  
  30. 30. fluent-­‐plugin-­‐delayed    -­‐  delayed  output  plugin.    h>ps://github.com/chobie/fluent-­‐plugin-­‐delayed   Client event{    Lme:  2011-­‐10-­‐22  10:00:05,  #  5  seconds  future    ...   }   delayed  plugin :  aler  5  seconds.  then  delayed  plugin  outputs   the  data  to  other  output  plugin.   output
  31. 31. other  Ideas.    fluent-­‐plugin-­‐cooldown    -­‐  coolodowned  outputs  when  specified  key  received.    fluent-­‐plugin-­‐sampler    -­‐  only  outputs  N  %  data.  
  32. 32. GitHQ  /  Kokuban  Github  /  gist  clone  (sLll  under  development)
  33. 33. updaLng  ssh  key    is    pain  in  ass. /home/git/.ssh/authorized_keys
  34. 34. updaLng  SSH  Authorized  keys only  pass  cooldowned   message. send  public  key client web  server fluentd cooldown exec sending  message  via  fluentdLogger redis update  authorized_keys   obtain  ssh  public  keys
  35. 35. Web  developer  only  knows  tag  for  queued  job.
  36. 36. Web  developer  only  knows  tag  for  queued  job. Server  engineer  only  implements  reliable  consumer  plugin  for  Fluentd.
  37. 37. Sounds  good?
  38. 38. fluent-­‐logger-­‐php  status.
  39. 39. fluentd  protocol  support  ✔  h>p  protocol  support  ✔  composer  support  ✔  PEAR  package  support  ✔  -­‐  but  I  don’t  provide  pear  channel.      message  pack  support  buffering  support  -­‐  does  not  support  as  there’s  trouble  some  for  using  persistent  variables  for  buffer.    
  40. 40. That’s  all  
  41. 41. That’s  all  i  need  more  developer!  please  feel  free  to  pull  req  me.    h>ps://github.com/chobie  

×