-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
313 lines (284 loc) · 18.3 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
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>ELK - Présentation ElasticSearch-Logstash-Kibana</title>
<meta name="description" content="Présentation ElasticSearch-Logstash-Kibana">
<meta name="author" content="Gauthier C.">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/sky.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>ELK</h1>
<h3>Analyse de Logs avec</h3>
<h3>ElasticSearch-Logstash-Kibana</h3>
<p><small><small>
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Présentation ELK</span> de <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName"><a href="http://twitter.com/CattGr">@CattGr</a></span> est mis à disposition selon les termes de la <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">licence Creative Commons Attribution 4.0 International</a></small></small>
</p>
</section>
<!-- ########################################################################################## -->
<section id="abstract">
<h2>En 40 minutes environ</h2>
<ol>
<li>Avant ...</li>
<li>Présentation d'ELK</li>
<li>Démo</li>
<li>Architecture</li>
<li>Alimentation avec LogStash</li>
<li>Outils annexes</li>
</ol>
</section>
<!-- ########################################################################################## -->
<section>
<section id="avant">
<h2>Avant ...</h2>
<h3>Et bien oui, ElasticSearch n'a pas toujours existé</h3>
</section>
<section id="ilyalongtemps">
<h3>Il y a très longtemps</h3>
<ul>
<li class="fragment">Fichiers de logs réparties sur x serveurs.</li>
<li class="fragment">Difficile de retrouver l'information.</li>
<li class="fragment">Impossible de faire de la corrélation.</li>
<li class="fragment">Pas d'archivage des journaux (quelques jours au plus).</li>
<li class="fragment">Impossible de trouver une vieille information.</li>
</ul>
</section>
<section id="ensuite">
<h3>Première amélioration</h3>
<ul>
<li class="fragment">Rsyslog centralisé.</li>
<li class="fragment">Consolidation des fichiers par type de logs.</li>
<li class="fragment">Horodatage précis.</li>
<li class="fragment">[bz|z]grep, awk, sed</li>
<li class="fragment">Parfois des heures pour trouver une information.</li>
</ul>
</section>
<section id="maintenant">
<h3>Depuis la mise en place d'ELK</h3>
<ul>
<li class="fragment">Quelques secondes pour retouver une information.</li>
<li class="fragment">Recherche et corrélation possible dans plusieurs fichiers de logs.</li>
<li class="fragment">Détection de comportements anormaux.</li>
<li class="fragment">Tableaux de bord personnalisables.</li>
<li class="fragment">Filtres multicritères.</li>
</ul>
</section>
</section>
<!-- ########################################################################################## -->
<section>
<section id="ELK">
<h1>Présentation d'ELK</h1>
</section>
<section>
<h2>ELK c'est quoi?</h2>
<ul>
<li class="fragment"><b><font color=blue>E</font>lasticsearch</b> - Base NoSql distribuée et moteur de recherche Lucene</li>
<li class="fragment"><b><font color=blue>L</font>ogstash</b> - ETL spécialisé dans la gestion des logs</li>
<li class="fragment"><b><font color=blue>K</font>ibana</b> - Interface graphique pour Elasticsearch</li>
</ul>
</section>
<section>
<h2>ElasticSearch</h2>
<img src="images/elasticsearch-date.png" style="background:none; border:none; box-shadow:none;" />
</section>
<section>
<img src="images/logo-elastic.png" align="left" style="background:none; border:none; box-shadow:none;" />
<h3>ElasticSearch</h3>
ElasticSearch est un support de stockage haute performance permettant d’effectuer des recherches full-text en un éclair sur des Gigas de données.
<ul>
<li class="fragment">Orienté Document</li>
<li class="fragment">Sans schéma (pas de définition stricte du contenu des index)</li>
<li class="fragment">Possibilité de distribuer sur plusieurs nœuds</li>
<li class="fragment">Hautement disponible</li>
<li class="fragment">Basé sur le moteur de recherche full-text Lucene</li>
<li class="fragment">Accessible à partir d’une API REST</li>
<li class="fragment">Open source</li>
</ul>
</section>
<section>
<h2>LogStash</h2>
<img src="images/logstash.png" style="background:none; border:none; box-shadow:none;" />
</section>
<section>
<img src="images/logstash.png" align="left" style="background:none; border:none; box-shadow:none;" height="200" />
<h3>LogStash est un ETL (Extract-Transform-Load)</h3>
<p class="fragment">Il permet nativement de :</p>
<ul>
<li class="fragment">Récupérer les logs provenant de sources variées, </li>
<li class="fragment">Transformer les logs vers de multiples formats, </li>
<li class="fragment">Sauvegarder le résultat de la transformation vers différents systèmes de stockage.</li>
</ul>
</section>
<section>
<h3>LogStash propose par défaut:</h3>
<ul>
<li class="fragment"><b>41 entrées</b> : syslog, zeromq, file, collectd, pipe, eventlog, etc... </li>
<li class="fragment"><b>20 codecs</b> : json, json_lines, multiline, etc... </li>
<li class="fragment"><b>50 filtres</b> : grok, date, geoip, mutate, etc... </li>
<li class="fragment"><b>55 sorties</b> : elasticsearch, stdout, rabbitmq, graphite, etc...</li>
</ul>
</section>
<section>
<h2>Kibana</h2>
<img src="images/kibana.png" style="background:none; border:none; box-shadow:none;" />
</section>
<section>
<h3>Kibana est l'interface web de référence d'ElasticSearch</h3>
Depuis la version 4, les opérations dans kibana se décomposent en 3 parties :
<ul>
<li class="fragment"><b>Discover</b>: permet de visualiser les données des index elasticsearch.</li>
<li class="fragment"><b>Visualize</b>: cœur de kibana pour mettre en forme et agréger les données dans des vues. </li>
<li class="fragment"><b>Dashboard</b>: pages de synthèse des vues.</li>
</ul>
</section>
<section>
<h3>Discover</h3>
<img src="images/discover.png" style="background:none; border:none; box-shadow:none;" />
</section>
<section>
<h3>Visualize</h3>
<img src="images/visualize.png" style="background:none; border:none; box-shadow:none;" />
</section>
<section>
<h3>Dashboard</h3>
<img src="images/dashboard.png" style="background:none; border:none; box-shadow:none;" />
</section>
</section>
<!-- ########################################################################################## -->
<section>
<section>
<h2><a href="http://localhost:5601/" target="_blank">Démo</a></h2>
<img src="images/Man-of-Steel.jpg" style="background:none; border:none; box-shadow:none;" />
</section>
</section>
<!-- ########################################################################################## -->
<section>
<section>
<h2>Architecture</h2>
<img src="images/architecture.svg" style="background:none; border:none; box-shadow:none;" />
</section>
</section>
<!-- ########################################################################################## -->
<section>
<section>
<h2>Alimentation avec LogStash</h2>
<h3>input</h3>
Exemple de fichier de configuration logstash
<pre><code data-trim contenteditable>
input {
file {
type => "apache"
path => "/var/log/remote/HTTP/20*/*/vncache*.log"
}
}
</code></pre>
</section>
<section>
<h3>filter</h3>
<pre><code data-trim contenteditable>
filter {
if [loglevel] == "debug" {
drop { }
}
if [type] == "apache" {
grok {
patterns_dir => [ "/home/logstash/patterns" ]
match => [
"message", "%{SYSLOGBASE} %{COMBINEDAPACHELOG}",
"message", "%{COMBINEDAPACHELOG}"
]
tag_on_failure => [ ]
}
date {
match => [ 'timestamp', 'dd/MMM/yyyy:HH:mm:ss Z' ]
locale => "en"
timezone => "Europe/Paris"
target => "@timestamp"
}
}
}
</code></pre>
</section>
<section>
<h3>output</h3>
<pre><code data-trim contenteditable>
utput {
if [type] == "apache" {
elasticsearch {
bind_host => "127.0.0.1"
host => "127.0.0.1"
index => "heberge-%{+YYYY.MM.dd}"
}
}
}
</code></pre>
</section>
<section>
<h2>Patterns</h2>
De nombreuses règles par défaut dans /opt/logstash/patterns/
<pre><code data-trim contenteditable>
SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:
COMMONAPACHELOG %{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-)
</code></pre>
</section>
</section>
<!-- ########################################################################################## -->
<section>
<section>
<h2>Outils annexes</h2>
<ul>
<li class="fragment"><b>Grok Debugger</b>: Permet de valider et tester les nouvelles règles grok. <a href="http://grokdebug.herokuapp.com/">http://grokdebug.herokuapp.com/</a></li>
<li class="fragment"><b>Curator</b>: Pour faire le ménage.</li>
<li class="fragment"><b>Packetbeat</b>: Agent analyse du trafic à déployer sur les serveurs.</li>
<li class="fragment"><b>Shield</b>: Limiter les accès à ElasticSearch.</li>
</ul>
</section>
</section>
<!-- ########################################################################################## -->
</div>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'convex', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>