J-Day Kraków: Listen to the sounds of your application
-
Upload
maciej-bilas -
Category
Technology
-
view
107 -
download
1
description
Transcript of J-Day Kraków: Listen to the sounds of your application
![Page 1: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/1.jpg)
Listen to the sounds of your application
![Page 2: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/2.jpg)
!2
Krzysztof Ciesielski
@kpciesielski
softwaremill.com
Lublin Software Craftsmen
![Page 4: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/4.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/5.jpg)
!5
Monitoring, huh?
![Page 7: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/7.jpg)
!7
Types of measurements
![Page 8: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/8.jpg)
!7
Types of measurements
Network
![Page 9: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/9.jpg)
!7
Types of measurements
Network
Machine
![Page 10: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/10.jpg)
!7
Types of measurements
Network
Machine
Application
![Page 12: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/12.jpg)
!9
measurement > prediction
![Page 13: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/13.jpg)
!10
![Page 14: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/14.jpg)
!11
measurement >> prediction
![Page 15: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/15.jpg)
!12
Our stack
![Page 16: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/16.jpg)
!12
Our stack
Server
App
Server
App
…
![Page 17: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/17.jpg)
!12
Our stack
Server
App
Server
App
…
Graphite Logstash
![Page 18: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/18.jpg)
!12
Our stack
Server
App
Server
App
…
Graphite Logstash
![Page 19: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/19.jpg)
!12
Our stack
Server
App
Server
App
…
Graphite Logstash
![Page 20: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/20.jpg)
!12
Our stack
Server
App
Server
App
…
Graphite Logstash
![Page 21: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/21.jpg)
!12
Our stack
Server
App
Server
App
…
Graphite Logstash
![Page 22: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/22.jpg)
!12
Our stack
Server
App
Server
App
…
Graphite Logstash
Yammer Metrics
![Page 23: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/23.jpg)
!13
Introducing Graphite
![Page 24: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/24.jpg)
!14
Graphite
![Page 25: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/25.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/26.jpg)
!16
successful.login.attempt 1 1384471287 successful.login.attempt 1 1384471297
![Page 27: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/27.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/28.jpg)
!17
Yammer Metrics
![Page 29: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/29.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/30.jpg)
!18
Metrics
![Page 31: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/31.jpg)
!18
MetricsTypes:
![Page 32: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/32.jpg)
!18
MetricsTypes:
•Gauges
![Page 33: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/33.jpg)
!18
MetricsTypes:
•Gauges
•Counters
![Page 34: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/34.jpg)
!18
MetricsTypes:
•Gauges
•Counters
•Meters
![Page 35: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/35.jpg)
!18
MetricsTypes:
•Gauges
•Counters
•Meters
•Histograms
![Page 36: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/36.jpg)
!18
MetricsTypes:
•Gauges
•Counters
•Meters
•Histograms
•Timers
![Page 37: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/37.jpg)
!18
MetricsTypes:
•Gauges
•Counters
•Meters
•Histograms
•Timers
•Health Checks
![Page 38: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/38.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/39.jpg)
!19
Counters, meters… vs.
Gauges
![Page 40: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/40.jpg)
!20
Aggregation
![Page 42: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/42.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/43.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/44.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/45.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/46.jpg)
!26
Logstash
Open Source (written in JRuby)
![Page 47: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/47.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/48.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/49.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/50.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/51.jpg)
!27
Logstash centralized architecture
![Page 52: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/52.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/53.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/54.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/55.jpg)
!30
Kibana
![Page 56: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/56.jpg)
!31
Kibana checking general app activity
![Page 57: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/57.jpg)
!32
Kibana Spotting anomalies
![Page 58: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/58.jpg)
!33
Kibana Checking regular events
![Page 59: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/59.jpg)
!34
Kibana How often is this feature used?
![Page 60: J-Day Kraków: Listen to the sounds of your application](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/60.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/61.jpg)
!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](https://reader031.fdocuments.net/reader031/viewer/2022020306/54c64ac44a7959f3648b4569/html5/thumbnails/62.jpg)
!37