j-day kraków: listen to the sounds of your application

63
Listen to the sounds of your application

Upload: maciej-bilas

Post on 26-Jan-2015

107 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: J-Day Kraków: Listen to the sounds of your application

Listen to the sounds of your application

Page 2: J-Day Kraków: Listen to the sounds of your application

!2

Krzysztof Ciesielski

@kpciesielski

softwaremill.com

Lublin Software Craftsmen

Page 3: J-Day Kraków: Listen to the sounds of your application

!3

Maciej Biłas

@maciejb

softwaremill.com

jbison.com

Page 4: J-Day Kraków: 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: J-Day Kraków: Listen to the sounds of your application

!5

Monitoring, huh?

Page 6: J-Day Kraków: Listen to the sounds of your application

!6

source: codeascraft.com

Page 7: J-Day Kraków: Listen to the sounds of your application

!7

Types of measurements

Page 8: J-Day Kraków: Listen to the sounds of your application

!7

Types of measurements

Network

Page 9: J-Day Kraków: Listen to the sounds of your application

!7

Types of measurements

Network

Machine

Page 10: J-Day Kraków: Listen to the sounds of your application

!7

Types of measurements

Network

Machine

Application

Page 11: J-Day Kraków: Listen to the sounds of your application

!8

source: codeascraft.com

Page 12: J-Day Kraków: Listen to the sounds of your application

!9

measurement > prediction

Page 13: J-Day Kraków: Listen to the sounds of your application

!10

Page 14: J-Day Kraków: Listen to the sounds of your application

!11

measurement >> prediction

Page 15: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Page 16: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Page 17: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 18: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 19: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 20: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 21: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Page 22: J-Day Kraków: Listen to the sounds of your application

!12

Our stack

Server

App

Server

App

Graphite Logstash

Yammer Metrics

Page 23: J-Day Kraków: Listen to the sounds of your application

!13

Introducing Graphite

Page 24: J-Day Kraków: Listen to the sounds of your application

!14

Graphite

Page 25: J-Day Kraków: Listen to the sounds of your application

!15

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

Page 26: J-Day Kraków: Listen to the sounds of your application

!16

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

Page 27: J-Day Kraków: Listen to the sounds of your application

!16

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

=> successful.login.attempt = 1

Page 28: J-Day Kraków: Listen to the sounds of your application

!17

Yammer Metrics

Page 29: J-Day Kraków: Listen to the sounds of your application

!17

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 30: J-Day Kraków: Listen to the sounds of your application

!18

Metrics

Page 31: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

Page 32: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

Page 33: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

•Counters

Page 34: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

•Counters

•Meters

Page 35: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

Page 36: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

•Timers

Page 37: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

•Timers

•Health Checks

Page 38: J-Day Kraków: Listen to the sounds of your application

!18

MetricsTypes:

•Gauges

•Counters

•Meters

•Histograms

•Timers

•Health Checks

Reporters:

•STDOUT

•CSV

•SLF4J

•JMX

•Graphite

•Ganglia

Page 39: J-Day Kraków: Listen to the sounds of your application

!19

Counters, meters… vs.

Gauges

Page 40: J-Day Kraków: Listen to the sounds of your application

!20

Aggregation

Page 41: J-Day Kraków: Listen to the sounds of your application

!21

source: codeascraft.com

Page 42: J-Day Kraków: Listen to the sounds of your application

!22

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 43: J-Day Kraków: Listen to the sounds of your application

!23

Event Sourcing

Tracing and storing all the events

Current app state: replaying the stream

Great for data mining and analysis

Page 44: J-Day Kraków: Listen to the sounds of your application

!24

Log aggregation

Less invasive way to build an “event stream”

Logs are data with plenty of value

Page 45: J-Day Kraków: Listen to the sounds of your application

!25

Log aggregation

Log source

Log source

Log source

Central storage

Query engine

Web view

Page 46: J-Day Kraków: Listen to the sounds of your application

!26

Logstash

Open Source (written in JRuby)

Page 47: J-Day Kraków: Listen to the sounds of your application

!26

Logstash

Open Source (written in JRuby)

Gathers logs from various inputs

Page 48: J-Day Kraków: Listen to the sounds of your application

!26

Logstash

Open Source (written in JRuby)

Gathers logs from various inputs

Parses and extracts metadata

Page 49: J-Day Kraków: Listen to the sounds of your application

!26

Logstash

Open Source (written in JRuby)

Gathers logs from various inputs

Writes to various outputs

Parses and extracts metadata

Page 50: J-Day Kraków: Listen to the sounds of your application

!26

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 51: J-Day Kraków: Listen to the sounds of your application

!27

Logstash centralized architecture

Page 52: J-Day Kraków: Listen to the sounds of your application

!28

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 53: J-Day Kraków: Listen to the sounds of your application

!28

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 54: J-Day Kraków: Listen to the sounds of your application

!29

Logstash simple use cases

Output: e-mail alert

ExceptionsSecurity issuesRare and business-meaningful events

Grok:

Page 55: J-Day Kraków: Listen to the sounds of your application

!30

Kibana

Page 56: J-Day Kraków: Listen to the sounds of your application

!31

Kibana checking general app activity

Page 57: J-Day Kraków: Listen to the sounds of your application

!32

Kibana Spotting anomalies

Page 58: J-Day Kraków: Listen to the sounds of your application

!33

Kibana Checking regular events

Page 59: J-Day Kraków: Listen to the sounds of your application

!34

Kibana How often is this feature used?

Page 60: J-Day Kraków: Listen to the sounds of your application

!35

Kibana Displaying multiple query results

Query: exception Type: applog

Query: index Type: mongolog

Page 61: J-Day Kraków: Listen to the sounds of your application

!36

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 62: J-Day Kraków: Listen to the sounds of your application

!37

Page 63: J-Day Kraków: Listen to the sounds of your application

!38

Reach us at: @maciejb and @kpciesielski

softwaremill.comThank You