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

When Monolog meet ELK

When Monolog meet ELK

talk given during sfPot Paris

Olivier Dolbeau

July 15, 2014
Tweet

More Decks by Olivier Dolbeau

Other Decks in Programming

Transcript

  1. When
    Monolog
    meet
    ELK

    View Slide

  2. Me
    Olivier Dolbeau
    @odolbeau
    Web Architect

    View Slide

  3. Monolog

    View Slide

  4. Handlers
    ● StreamHandler
    ● ErrorLogHandler
    ● SwiftMailerHandler
    ● SyslogUdpHandler
    ● FirePHPHandler
    ● FingersCrossedHandler
    ● NullHandler
    ● …
    more than 36 handlers!

    View Slide

  5. Channels
    Just a name for your logger.
    http://symfony.com/doc/current/cookbook/logging/channels_handlers.html

    View Slide

  6. View Slide

  7. Processors

    View Slide

  8. View Slide

  9. PSR-3 dude !

    View Slide

  10. PSR-3 dude !
    Context
    Context
    Context

    View Slide

  11. What can I do with that?
    ● Different handlers for different usage
    ○ FirePHP for web
    ○ Console for cli
    ● Processor per handler
    ● Processor per channel
    http://symfony.com/doc/current/cookbook/logging/channels_handlers.html

    View Slide

  12. View Slide

  13. Few things you can do
    ● All my cli logs are displayed in console
    ● I use FirePHP for web
    ● publication logs are very important. I want to
    receive an email if an exception occurred.
    ● I have a processor dedicated to workers. I
    can directly see which message raise an
    error.
    ● I have a processor dedicated to web (you
    saw it)
    ● ...

    View Slide

  14. View Slide

  15. View Slide

  16. SSH ?

    View Slide

  17. View Slide

  18. I found some IPs !

    View Slide

  19. I found the criticity !

    View Slide

  20. Maybe it’s the one I want ?

    View Slide

  21. View Slide

  22. E L K

    View Slide

  23. ● real time data
    ● distributed
    ● multi-tenancy
    ● document oriented
    ● schema free
    ● per operation
    persistence
    ● real time analytics
    ● high availability
    ● full text search
    ● conflict management
    ● restful api
    ● built on top of apache
    lucene

    View Slide

  24. It’s all about logs!
    ● Inputs (41)
    ● Filters (50)
    ● Outputs (55)
    Logstash

    View Slide

  25. Input example

    View Slide

  26. Filter example

    View Slide

  27. Output example

    View Slide

  28. Kibana

    View Slide

  29. Not bad right? :D

    View Slide

  30. View Slide

  31. How to :
    send logs with Monolog
    to ELK ?

    View Slide

  32. Gelf

    View Slide

  33. View Slide

  34. Logstash input for gelf

    View Slide

  35. Demo

    View Slide

  36. Conclusion
    ● Use Monolog (easy!)
    ● Use ELK
    ● Use monolog context
    ● Create dashboards
    ● Enjoy!

    View Slide

  37. View Slide