YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: Listen to the sounds of your application

Listen to the sounds of your application

Listen to the sounds of your application

Page 2: Listen to the sounds of your application

!2

Krzysztof Ciesielski

@kpciesielski

softwaremill.com

Lublin Software Craftsmen

Page 3: Listen to the sounds of your application

!3

Maciej Biłas

@maciejb

softwaremill.com

jbison.com

Page 4: Listen to the sounds of your application

!4

• Monitoring, huh?

• Introducing Graphite

• Log analysis – the whys

• Logstash architecture & use cases

• Exploring logs with Kibana

Agenda

Page 5: Listen to the sounds of your application

!5

Monitoring, huh?

Page 6: Listen to the sounds of your application

!6

source: codeascraft.com

Page 7: Listen to the sounds of your application

!7

Types of measurements

Page 8: Listen to the sounds of your application

!7

Types of measurements

Network

Page 9: Listen to the sounds of your application

!7

Types of measurements

Network

Machine

Page 10: Listen to the sounds of your application

!7

Types of measurements

Network

Machine

Application

Page 11: Listen to the sounds of your application

!8

source: codeascraft.com

Page 12: Listen to the sounds of your application

!9

measurement > prediction

Page 13: Listen to the sounds of your application

!10

Page 14: Listen to the sounds of your application

!11

measurement >> prediction

Page 15: Listen to the sounds of your application

!12

Our stack

Page 16: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Page 17: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 18: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 19: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 20: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 21: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 22: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Yammer Metrics

Page 23: Listen to the sounds of your application

!13

Introducing Graphite

Page 24: Listen to the sounds of your application

!14

http://graphite/render?target=server.web1.load&height=800&width=600

Page 25: Listen to the sounds of your application

!15

Graphite

Page 26: Listen to the sounds of your application

!16

PORT=2003 SERVER=graphite.your.org echo "local.random.diceroll 4 `date +%s`" | nc ${SERVER} ${PORT}; 

Page 27: Listen to the sounds of your application

!17

successful.login.attempt 1 1384471287 successful.login.attempt 1 1384471297

Page 28: Listen to the sounds of your application

!17

successful.login.attempt 1 1384471287 successful.login.attempt 1 1384471297

=> successful.login.attempt = 1

Page 29: Listen to the sounds of your application

!18

Yammer Metrics

Page 30: Listen to the sounds of your application

!18

Yammer Metrics

private final Meter successfulLogins = metrics.meter(name(LoginHandler.class, "successful")); !public void login(String user, String password) { if (canLogin(user,password)) { successfulLogins.mark(); // ... } else { // ... } }

Page 31: Listen to the sounds of your application

!19

Metrics

Page 32: Listen to the sounds of your application

!19

MetricsTypes:

Page 33: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

Page 34: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

•Counters

Page 35: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

•Counters

•Meters

Page 36: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

Page 37: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

•Timers

Page 38: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

•Timers

•Health Checks

Page 39: Listen to the sounds of your application

!19

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

•Timers

•Health Checks

Reporters:

•STDOUT

•CSV

•SLF4J

•JMX

•Graphite

•Ganglia

Page 40: Listen to the sounds of your application

!20

Counters, meters… vs.

Gauges

Page 41: Listen to the sounds of your application

!21

Aggregation

Page 42: Listen to the sounds of your application

!22

source: codeascraft.com

Page 43: Listen to the sounds of your application

!23

You can also check out• collectd https://collectd.org

• StatsD https://github.com/etsy/statsd/

• Riemman http://riemann.io/

• Twitter’s Ostrich https://github.com/twitter/ostrich

• Ganglia http://ganglia.sourceforge.net/

• Dashboards: http://shopify.github.io/dashing/ https://github.com/obfuscurity/descarteshttps://github.com/obfuscurity/dusk

Page 44: Listen to the sounds of your application

!24

Event Sourcing

Tracing and storing all the events

Current app state: replaying the stream

Great for data mining and analysis

Page 45: Listen to the sounds of your application

!25

Log aggregation

Less invasive way to build an “event stream”

Logs are data with plenty of value

Page 46: Listen to the sounds of your application

!26

Log aggregation

Log source

Log source

Log source

Central storage

Query engine

Web view

Page 47: Listen to the sounds of your application

!27

Logstash

Open Source (written in JRuby)

Page 48: Listen to the sounds of your application

!27

Logstash

Open Source (written in JRuby)

Gathers logs from various inputs

Page 49: Listen to the sounds of your application

!27

Logstash

Open Source (written in JRuby)

Gathers logs from various inputs

Parses and extracts metadata

Page 50: Listen to the sounds of your application

!27

Logstash

Open Source (written in JRuby)

Gathers logs from various inputs

Writes to various outputs

Parses and extracts metadata

Page 51: Listen to the sounds of your application

!27

Logstash

Similar tools: !Splunk, Graylog, Fluentd, log.io

Open Source (written in JRuby)

Gathers logs from various inputs

Writes to various outputs

Parses and extracts metadata

Page 52: Listen to the sounds of your application

!28

Logstash centralized architecture

Page 53: Listen to the sounds of your application

!29

Logstash grok

2013-11-10 19:41:25.321 [main] INFO o.a.camel.impl.DefaultCamelContext !- Apache Camel 2.11.1 (CamelContext: camel-1) started in 4.450 seconds

Page 54: Listen to the sounds of your application

!29

Logstash grok

2013-11-10 19:41:25.321 [main] INFO o.a.camel.impl.DefaultCamelContext !- Apache Camel 2.11.1 (CamelContext: camel-1) started in 4.450 seconds

time 2013-11-10 19:41:25.321

thread main

loglevel INFO

source o.a.camel.impl.DefaultCamelContext

message Apache Camel 2.11.1 (CamelContext: camel-1) started in 4.450 seconds

Page 55: Listen to the sounds of your application

!30

Logstash simple use cases

Output: e-mail alert

ExceptionsSecurity issuesRare and business-meaningful events

Grok:

Page 56: Listen to the sounds of your application

!31

Kibana

Page 57: Listen to the sounds of your application

!32

Kibana checking general app activity

Page 58: Listen to the sounds of your application

!33

Kibana Spotting anomalies

Page 59: Listen to the sounds of your application

!34

Kibana Checking regular events

Page 60: Listen to the sounds of your application

!35

Kibana How often is this feature used?

Page 61: Listen to the sounds of your application

!36

Kibana Displaying multiple query results

Query: exception Type: applog

Query: index Type: mongolog

Page 62: Listen to the sounds of your application

!37

References• Graphite http://graphite.readthedocs.org/en/latest/

• Yammer Metrics http://metrics.codahale.com/

• Logstash http://logstash.net/

• Surfing the event stream by Sam Newman at Geecon http://www.slideshare.net/spnewman/surfing-the-event-stream

• Lessons from Building and Scaling LinkedIn by Jay Krepshttp://www.infoq.com/presentations/linkedin-architecture-stack

• Code as Craft http://codeascraft.com/

Page 63: Listen to the sounds of your application

!38

Page 64: Listen to the sounds of your application

Reach us at: @maciejb and @kpciesielski

softwaremill.comThank You


Related Documents