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

Monitoring your Application

Monitoring your Application

A talk about monitoring your application (primarily Symfony2, but also applicable to any PHP project, or indeed web project), given at November Camp by Symfony Sweden.

Magnus Nordlander

November 22, 2013
Tweet

More Decks by Magnus Nordlander

Other Decks in Programming

Transcript

  1. About me • Magnus Nordlander • Symfony consultant at Fervo

    AB • 10 years of PHP experience • SensioLabs certified Symfony Developer (expert level)
  2. Strategy • Log exceptions and errors • Monitor server and

    application status • Monitor performance • E-mail us if something's out of whack • Collect metrics on usability
  3. An even better strategy • Log everything • Monitor and

    record server and application status • Monitor and record performance • Message and call us if something's out of whack • Collect and present metrics on usability
  4. Logging • Log everything • Use log levels and channels

    to differentiate • Use PSR-3 • Use a framework with logging support
  5. Logging in Symfony • Ships with Monolog, PSR-3 compatible •

    Logs a lot, at various levels • Add gelf-php, and configure the GelfHandler
  6. Logging in Symfony monolog: handlers: main: type: fingers_crossed action_level: info

    handler: nested nested: type: gelf publisher: hostname: localhost # required port: 12201 # optional chunk_size: 1420 # optional
  7. What should I log? • Symfony logs • Web server

    logs • PHP error logs • Varnish logs • SSH login attempts
  8. Graylog2 • Keep logs for as long as you can

    • Utilize the extra fields • Add correlation fields • Set up monitoring
  9. New Relic • Use key transactions • Tune your Apdex-T

    • Set up alerting • Use the plug-ins
  10. Statsd / Graphite • Collect as much as you can

    • Build a dashboard • Get TVs for your developers and ops people • Alerting via Seyren
  11. Code structure • Events with logging and statistics listeners •

    Statistics collectors • Libraries with PSR-3 support
  12. Questions? • Contact me at [email protected] • Follow me on

    Twitter: @drrotmos and @FervoAB • Rate my talk at joind.in/10128