-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·436 lines (388 loc) · 11.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<!DOCTYPE html>
<!--
Rackspace HTML5 slide template,
based completely on the:
Google HTML5 slide template
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
URL: http://code.google.com/p/html5slides/
-->
<html>
<head>
<title>Logging as Event Streams</title>
<meta charset='utf-8'>
<script
src='./slides.js'></script>
</head>
<style>
/* Your individual styles here, or just use inline styles if that’s
what you want. */
</style>
<body style='display: none'>
<section class='slides template-rax'>
<!--
* Logging As Event Streams
* 4 areas:
* Log Formats
* events = machine parsable.
* Error IDs
* Trace IDs
* Log Transportation
* Logging Aggregation
* In Rest APIs / Audit Logs
-->
<article>
<h1>
Logging as Event Streams
<br>
</h1>
<p>
Paul Querna
<br>
June 27, 2012
</p>
</article>
<article>
<h3>
Why I care about Logging
</h3>
<ul class="build">
<li>Apache HTTP Server:
<br/>
<ul>
<li>#httpd on Freenode IRC</li>
</ul>
</li>
<li>Rackspace:
<br/>
<ul>
<li>I work on <a href="http://www.rackspace.com/cloud/cloud_hosting_products/monitoring/">Cloud Monitoring</a></li>
<li>API Driven, Monitoring as a Service.</li>
<li>Distributed across all Rackspace data centers.</li>
<li>Async events trigger support issues.</li>
<li>When things break, we can be called in.</li>
</ul>
</li>
</ul>
</article>
<article>
<h3>
Application vs System Logging
</h3>
<ul class="build">
<li>I am focusing on Application and Service Logging, not OS level.</li>
<li>Don't abandon <code>syslog</code>, supplement it.</li>
</ul>
</article>
<article>
<h3>
Motivation: Logging Meets "Cloud"
</h3>
<ul class="build">
<li>Traditionally <em>Perl Powered™</em></li>
<li>Many more Services.</li>
<li>Services are multi-tenanted.</li>
<li>Services run across many Servers.</li>
<li>Services owned by many Teams.</li>
<li><strong>Operability is critical to sustainability</strong></li>
</ul>
</article>
<article>
<h3>
Logging is an Event Emitter
</h3>
<div class="build">
<pre>logging.error('Something is wrong');</pre>
<pre>emit('log', {level: 'error', msg: 'Something is wrong'});</pre>
<p>There is no difference here.</p>
</div>
</article>
<article>
<h3>
Structured Logging
</h3>
<ul>
<li>Not a new idea!</li>
<li>Most logs already have some structure.</li>
<li>1995: Common Log Format</li>
<pre>10.42.0.1 - - [10/Oct/2000:13:55:36 -0700]
"GET /apache_pb.gif HTTP/1.0" 200 2326</pre>
</ul>
</article>
<article>
<h3>
Why Structured Logging?
</h3>
<ul>
<li>Many Producers, many Consumers</li>
<li>Many Programming Languages.</li>
<li>Services developed with only loose coupling.</li>
</ul>
</article>
<article>
<h3>
Structured Logging: JSON?
</h3>
<ul>
<li>Accessible in all Programming Languages</li>
<li>Newline terminated.</li>
<li><code>grep</code> works.</li>
</ul>
</article>
<article>
<h3>
HTTP Example
</h3>
<pre>
{
"timestamp": 1324830675.076,
"status": "404",
"short_message": "File does not exist: /var/www/no-such-file",
"host": "ord1.product.api0",
"facility": "httpd",
"errno": "ENOENT",
"remote_host": "50.57.61.4",
"remote_port": "40100",
"path": "/var/www/no-such-file",
"uri": "/no-such-file",
"level": 4,
"headers": {
"user-agent": "BadAgent/1.0",
"connection": "close",
"accept": "*/*"
},
"method": "GET",
"unique_id": ".rh-g2Tm.h-ord1.product.api0.r-axAIO3bO.c-9210.ts-1324830675.v-24e946e"
}
</pre>
</article>
<article>
<h3>CLF vs JSON</h3>
<br/>
<div>Perl Cookbook says:</div>
<div class="build">
<pre>
my ($client, $identuser, $authuser, $date, $time, $tz, $method,
$url, $protocol, $status, $bytes) =
/^(\S+) (\S+) (\S+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] "(\S+) (.*?) (\S+)"
(\S+) (\S+)$/;
</pre>
<pre>
$msg = JSON->decode($json_text);
</pre>
<ul>
<li>Now a developer adds a new field.</li>
</ul>
</div>
</article>
<article>
<h3>Elements of Every Log Message</h3>
<ul>
<li>Timestamps, Host, Messages, Levels...</li>
</ul>
</article>
<article>
<h3>
Message Tags / IDs
</h3>
<ul class="build">
<li>Easy to Search for strings.</li>
<li>Important for both Internal and Open Source.</li>
<li>Added in Apache HTTPD 2.4: "AH02182".
<br/>
<pre class="noprettyprint">[Wed Jun 27 00:00:17.242251 2012] [allowmethods:error]
[pid 70941:tid 4446611456] [client 203.0.113.3:4172]
<span style="color: red;">AH01623</span>: client method denied by server configuration:
'PROPFIND' to /x1/www/ooo-site.apache.org/content/3</pre>
</li>
</ul>
</article>
<article>
<h3>
Trace IDs
</h3>
<ul class="build">
<li>Unique ID assigned to actions at the edge of your network</li>
<li>Propagated to all your backend services.</li>
</ul>
</article>
<article>
<h3>
Trace IDs
</h3>
<img src="./img/TracingNetworks.png" height="90%">
</article>
<article>
<h3>
Trace IDs
</h3>
<pre class="noprettyprint">.rh-el1U.h-ord1-maas-prod-api0.
r-tvTCwfS3.c-33110.ts-1340775011499.v-c76a8c29</pre>
<ul class="build">
<li>rh: random on process startup</li>
<li>h: hostname</li>
<li>c: counter for this process</li>
<li>r: random per ID</li>
<li>ts: timestamp</li>
<li>v: Git version hash</li>
</ul>
</article>
<article>
<h3>
Trace IDs: Twitter Zipkin
</h3>
<br/>
<img src="./img/zipkin-shot.png" width="100%">
<ul>
<li>Open Sourced June 7th</li>
<li>Uses 64bit Integer as Trace ID</li>
<li>Aggregates via Scribe, stores in Cassandra, Ruby Web application</li>
</ul>
</article>
<article>
<h3>
Shipping Logs: Goals
</h3>
<ul class="build">
<li>If the network fails....</li>
<li>Always write to local disk.</li>
<li>Always write to local disk.</li>
<li>Always write to local disk.</li>
<li>Real Time-ish.</li>
</ul>
</article>
<article>
<h3>
svlogd, & Scribe.
</h3>
<img src="./img/logging-flow.png" width="100%">
</article>
<article>
<h3>
Shipping Logs between machines
</h3>
<ul>
<li>Scribe</li>
<li>Apache Flume</li>
<li>syslog</li>
</ul>
</article>
<article>
<h3>
Scribe
</h3>
<ul>
<li>Open Sourced by Facebook</li>
<li>Bulk Log mover</li>
<li>Can buffer, retry, hash distribution, etc</li>
</ul>
</article>
<article>
<h3>
Scribe Setup
</h3>
<br/>
<img src="./img/ScribeFlow.png" width="100%">
<ul class="build">
<li>Services always send to a <code>localhost</code></li>
<li>Local Scribe sends to higher level router Scribes.</li>
<li>Router Scribes forward to another Scribe which over localhost sends to Graylog2.</li>
</ul>
</article>
<article>
<h3>
Graylog2
</h3>
<ul>
<li>Open Source Web Application</li>
<li>Many Inputs (Syslog, Scribe, RabbitMQ)</li>
<li>Indexes into ElasticSearch</li>
</ul>
</article>
<article>
<h3>
Graylog2 Streams
</h3>
<br/>
<img src="./img/graylog2-streams.jpg" width="100%">
</article>
<article>
<h3>
Graylog2 Tracing
</h3>
<br/>
<img src="./img/graylog2-trace.jpg" width="100%">
</article>
<article>
<h3>
Graylog2 Message Permalink
</h3>
<br/>
<img src="./img/graylog2-permalink.jpg" width="100%">
</article>
<article>
<h3>
Detour: Audit Logs of HTTP APIs
</h3>
<ul>
<li>Phone support is asked when something was changed.</li>
<li>Not great for all types of APIs, works well for Monitoring Configuration.</li>
<li>Every mutation (POST/PUT/DELETE) is recorded.</li>
<li>Includes Headers and Request bodies.</li>
<li>Available as a user readable collection in the public API.</li>
</ul>
</article>
<article>
<h3>
Detour: Audit Logs of HTTP APIs
</h3>
<pre>
"values": [
{
"id": "541615e0-bee4-11e1-a3c9-69984867fc3c",
"timestamp": 1340642367038,
"method": "POST",
"url": "/v1.0/626873/entities/entMvVW47r/test-check",
"app": "checks",
"query": {},
"txnId": ".rh-TL0q.h-ord1-maas-prod-api0.r-8NQS2mx5.c-280514.ts-1340642366874.v-1a7152ba29615a722a2713bef4d4fe2b5c6ee7ae",
"payload": "{\"target_hostname\":\"www.example.com\",\"type\":\"remote.http\",\"details\":{},\"monitoring_zones_poll\":[\"mzord\",\"mzdfw\",\"mzlon\"]}",
"account_id": "626873",
"headers": {
"host": "monitoring.api.rackspacecloud.com",
"accept-encoding": "gzip,deflate",
"content-type": "application/json; charset=UTF-8",
"accept": "application/json",
"user-agent": "libcloud/0.10.1 (Rackspace Monitoring)",
"content-length": "140"
},
"statusCode": 400
},
</pre>
</article>
<article>
<h3>
Thank You & Questions
</h3>
<br/>
<h4>
<a href='http://paul.querna.org/slides/'>paul.querna.org/slides</a>
</h4>
<br/>
<div>
<h4>Links:</h4>
<ul>
<li><a href='http://twitter.com/pquerna'>@pquerna</a></li>
<li><a href="http://journal.paul.querna.org/">journal.paul.querna.org</a></li>
<li><a href="http://graylog2.org">graylog2.org</a></li>
<li><a href='https://github.com/twitter/zipkin'>github.com/twitter/zipkin</a></li>
</ul>
</div>
</article>
<article class='biglogo'>
</article>
</section>
</body>
</html>