Centralized logging Using lasers and other cool stuff Sylvain - - PowerPoint PPT Presentation

centralized logging
SMART_READER_LITE
LIVE PREVIEW

Centralized logging Using lasers and other cool stuff Sylvain - - PowerPoint PPT Presentation

Centralized logging Using lasers and other cool stuff Sylvain Fankhauser / Bastian Widmer Agenda The beginnings What Liip is doing now Goals Possible Solutions Our Solution Implementations (SF2, Drupal 6&7, other


slide-1
SLIDE 1

Centralized logging

Using lasers and other cool stuff

Sylvain Fankhauser / Bastian Widmer

slide-2
SLIDE 2

Agenda

  • The beginnings
  • What Liip is doing now
  • Goals
  • Possible Solutions
  • Our Solution
  • Implementations (SF2, Drupal 6&7, other

php apps)

  • Demo
slide-3
SLIDE 3

The early beginnings

August 2011 - Adrian Schwaller "Liipers like developing and Liipers are good in

  • developing. However when it's going to

maintenance we often lack of quality."

slide-4
SLIDE 4

The early beginnings

August 2011 - Adrian Schwaller "It is not rarely the case that the client has to inform us about an impediment. So why not developing an application that help us doing maintenance - a win-win solution."

slide-5
SLIDE 5

Stock-check: what are we doing now?

  • sending mails with logs (LOTS OF MAILS!)
  • checking manually (humans fail regularly!)
  • waiting for the client to complain about

issues on his website Not a good solution, right?

slide-6
SLIDE 6

Second iteration

Sylvain and Bastian - September 2012 We get a Year Goal to centralize logging

slide-7
SLIDE 7

Goals

  • introduce a standard platform
  • log unexpected results and thrown errors
  • early on detection of problems (DDOS,

Spammers)

  • be faster to notice the problem than our

customers

  • Create a PHP tool that could be easily

plugged into any type of application (SF2, Drupal, Mahara, Moodle)

slide-8
SLIDE 8

Solutions

there are many let's look at them!

slide-9
SLIDE 9

Splunk (splunk.com)

+ nice graphical interface + google.com for logfiles + easy to maintain + easy to setup + can do everything you dream about

  • costs a big amount of money $$$
slide-10
SLIDE 10

Loggly (loggly.com)

+ Cloud Based + no maintenance work needed (SaaS)

  • Costs: Depending on our needs - not cheap
  • Cloud Based (Security concerns)
slide-11
SLIDE 11

Graylog 2 (graylog2.org)

+ nice interface + not complicated to setup + active development

  • very young project and architectural changes

(mongodb -> elastic search)

slide-12
SLIDE 12

Kibana (kibana.org)

kibana went into our focus after we've done the

  • ecostar. It's quite nice but we did not test it

during our ecostar. Bastian short tested it afterwards on his own: + simple setup + actively maintained + multimegafunctional by use of logstash frontend/backend : ruby datastorage : elasticsearch

slide-13
SLIDE 13

Logstash, WHAT?

Logstash is the swiss army knife regarding logging needs, it's a translator between many different formats. e.g. translates .log files on the fly into gelf messages that could be consumed by graylog check : logstash.net

slide-14
SLIDE 14

le Setup

slide-15
SLIDE 15

graylog - what you could do

slide-16
SLIDE 16

graylog- what we do currently

slide-17
SLIDE 17

Graylog Server (currently)

  • Frontend - UDP Backend : Graylog - Java
  • Data Storage : MongoDB
slide-18
SLIDE 18

Graylog Server Changes v0.10

  • Frontend - UDP Backend :Graylog - Java
  • Data Storage : Elastic Search
  • optional : Logstash
  • new : Support for Plugins

○ GECKOBOARD - ohai hackday! ○ sending XMPP Jabber Messages ○ writing Graphs with Graphite ○ GELF over HTTP (a log entry is just a curl request away)

slide-19
SLIDE 19

Developers, developers, developers

finally some php ;)

slide-20
SLIDE 20

Use Graylog in your project

  • Configure your application to send logs to

Graylog

  • Very easy to use: log stuff as usual, it's

automatically sent to Graylog

  • Under the hood, you'll use a GELF library
  • Docs about integration in your project are

available here: http://liip.to/graylog

slide-21
SLIDE 21

Logging with Symfony >= 2.1

  • Add the GELF library to composer:

"require": { ... "mlehner/gelf-php": "1.0.*" }

slide-22
SLIDE 22

Logging with Symfony >= 2.1

  • Configure monolog:

services: gelf_formatter: class: Monolog\Formatter\GelfMessageFormatter arguments: ['clientdomain.com'] monolog: handlers: gelf: type: gelf publisher: hostname: log.liip.ch port: 12201 formatter: gelf_formatter level: warn

slide-23
SLIDE 23

Logging with Symfony >= 2.1

  • Then log stuff as usual:

$logger = $this->get('logger'); $logger->warn('Something went wrong');

slide-24
SLIDE 24

Logging with Symfony 2.0

  • The version of Monolog shipped with SF2

doesn't support GELF

  • Installation is a bit painful, but easy with the

guide @ http://liip.to/graylog

slide-25
SLIDE 25

Logging with Drupal 7

  • The easy way:

curl -L http://liip.to/graylogdrupal7 | sh

  • Adds the required modules as submodules
  • Enables them
  • Adds them to your modules.enabled file
slide-26
SLIDE 26

Logging with Drupal 7

  • The less-easy way:

○ Install the gelf-php library ○ Install the libraries and gelf modules ○ Use the gelf module hosted on my github account

slide-27
SLIDE 27

Logging with Drupal 6

  • Again the easy way:

curl -L http://liip.to/graylogdrupal6 | sh

  • Does the same as the Drupal 7 solution
  • Uses the 6.x modules branches
  • The less-easy way is the same as for Drupal 7
slide-28
SLIDE 28

Logging with other PHP apps

  • Use the gelf-php library from here: https:

//github.com/Graylog2/gelf-php

  • Create the message:

<?php require('GELFMessage.php'); require('GELFMessagePublisher.php'); $message = new GELFMessage(); $message->setShortMessage('ohai.'); $message->setFullMessage('i are a cats'); $message->setHost('clientdomain.com'); $message->setLevel(GELFMessage::CRITICAL); $message->setFile(__FILE__); $message->setLine(__LINE__); $message->setAdditional('the_grass', 'is green'); $message->setAdditional('skies', 'so blue');

slide-29
SLIDE 29

Logging with other PHP apps

  • Publish the message:

<?php ... $publisher = new GELFMessagePublisher('log.liip.ch'); $publisher->publish($message);

slide-30
SLIDE 30

DEMO!

slide-31
SLIDE 31

Questions?

slide-32
SLIDE 32

Thank You!

Logging for a better world : http://log.liip.ch username : liip password : on our pw.liip.ch server (search for graylog) http://liip.to/graylog