Logstash5. Jak wygląda przeciętny log
l
l
l
l
l
Blebleblebleblbe
blebleblebleblbe
blebleblebleblbe
blebleblebleblbe
blebleblebleblbe
6. Jak wygląda przeciętny log
DATA + RESZTA = WPIS
[18/Nov/2013:00:00:02 +0100] w15 65.55.24.234 302 5 - 0.017 192.168.64.125 1077
"GET /szukaj.html?zrodlo=404&slowo=lampy+zewnetrzne
+wiszace+kare+design+kare+design+lampa+wiszaca+
trumpet+dining+5er+33116+35a2647ce9a772fab8affaac5feb2a69
HTTP/1.1" "/produkt-lampy-zewnetrzne-wiszace-kare-designkare-design-lampa-wiszaca-trumpet-dining-5er-33116-35
a2647ce9a772fab8affaac5feb2a69.html" "-" "Mozilla/5.0
(compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
7. awk '($9 ~ /502/)' access.log | awk '{print $7}' | sort | uniq -c | sort -r
728 /wp-admin/install.php
466 /
146 /videos/
130 /wp-login.php
9. Czy więc jest LogStash
l
l
l
l
l
l
Koncentrator logów
Wygodny interface – KIBANA
Stabilność Java
OpenSource
Wyklikiwalność ustawień
GROK
15. LogStash
wstępna konfiguracja
input {
file {
path => "/var/log/http.log"
}
}
filter {
grok {
match => [ "message", "%{IP:client} %{WORD:method}
%{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}" ]
}
}
output {
elasticsearch { embedded => true }
}
22. 55.3.244.1 GET /index.html 15824 0.043
Jak to rozumieć?
( client ip ) (http request) (rsp bytes) (req time)
%{IP} %{WORD} %{URIPATHPARAM} %{NUMBER} %{NUMBER}
Postać ostateczna :
{
"client": "55.3.244.1",
"verb": "GET",
"request": "/index.html",
"bytes": 15824,
"time": 0.043,
}
23. TIPS & TRICKS
l
l
l
curl -s -XDELETE "http://localhost:9200/logstash-2013-11-10"
JAVA – Xms = Xmx
https://grokdebug.herokuapp.com/
ulimit -l unlimited
24. POMOCY ?!
irc: #logstash on freenode
mail: logstash-users@googlegroups.com
dodatki: kibana, logstash-cli, puppet modules, chef cookbooks