Created by Laurence J MacGuire a.k.a Liu Jian Ming
ThoughtWorks Xi’An, 2015/06/02
“Not only is it free. It’s better”
– Me
User interactions w/ out apps
Capture user input
Audit Trails - Who delete my stack?
Go meta - How long does it take to process log messages?
Go meta - How long does it take to process log messages?
Monitor beer brewing (!)
1) Make it reliable
event = {
# When the event was generated
"@timestamp": "2015-08-12T10:06:15.000Z",
# When the event was indexed/processed
"@timestamp.indexed": "2015-08-12T10:06:25.001Z",
# @timestamp.indexed - @timestamp == delay in seconds
"@timestamp.indexed.delay": 10.001,
# Delay rounded to the nearest second
"@timestamp.indexed.delay.rounded": 10,
# Delay arounded to the 5 second bins
"@timestamp.indexed.delay.rounded.5": 10
/* ... event continues */
}
2) “Have a clear ‘source of truth’ for log events”
3) “Make it easy for developers to submit data”
require 'logging/lumberjack'
Logging.appenders.syslog( "syslog", {
:layout => Logging.layouts.lumberjack(),
:ident => "my-awesome-ruby-application"
})
Logging.logger["my-class"].info({:key => "value", :another_key: 123})
Done! This is all developers need to care about.
4) “Ensure all apps log in an easily parseable format”
5) “Clearly mark the source of the messages – it’ll be useful later”
Each of those can be the slice of a pie chart!
6) “Enable event tracing”
Akamai => HA Proxy => Nginx => Unicorn => Active Record
Follow events per transaction through the stack
Browser:
GET /users/1; DROP TABLE `users`; HTTP/1.1
CDN:
GET /users/1; DROP TABLE `users`; HTTP/1.1
x-request-id: 123-234-345
…
SQL
/* x-request-id: 123-234-345 */ SELECT * FROM `users` WHERE id = 1; DROP TABLE `users`;
Perhaps your CDN can set an ID? Perhaps you can compute one?
6) “Provide simple alternate input methods for non-traditional uses”
“It scales”
“It scales to OVER 9000!”
It will input, clean, manipulate and index your data easily.
It provides 90% of functionality with 10% of effort.
Multiple threads?
Config format and custom plugins?
Enter: Complex Event Processing
It’s much easier if you merge all your cleaned sources into one.
Once you get a clean event pipeline w/ Logstash, you can start thinking about C.E.P.
I see what you did there
Shuttle your events through a DAG of computations
Green Node = “Spout” = Data Input
Blue Node = “Bolt” = Data Processing
“Bolts” and “Spouts” map to a class
Each class runs in one or more threads
But plan as though you do. Your logs are first class citizens. And deserve to be treated as such.
You can get tremendous value out of them.