Jestem nowym użytkownikiem stosu ELK. Używam UWSGI jako mojego serwera. Muszę przeanalizować moje dzienniki uwsgi przy użyciu Grok, a następnie je przeanalizować.Filtr Logstash Grok dla dzienników uwsgi
Oto format moich logów: -
[pid: 7731|app: 0|req: 357299/357299] ClientIP() {26 vars in 511 bytes} [Sun Mar 1 07:47:32 2015] GET /?file_name=123&start=0&end=30&device_id=abcd&verif_id=xyzsghg => generated 28 bytes in 1 msecs (HTTP/1.0 200) 2 headers in 79 bytes (1 switches on core 0)
użyłem this link do generowania mój filtr, ale nie analizować wiele informacji.
Filtr generowane przez powyższy link jest
%{SYSLOG5424SD} %{IP}() {26 vars in 511 bytes} %{SYSLOG5424SD} GET %{URIPATHPARAM} => generated 28 bytes in 1 msecs (HTTP%{URIPATHPARAM} 200) 2 headers in 79 bytes (1 switches on core 0)
Oto mój plik logstash-conf.
input { stdin { } }
filter {
grok {
match => { "message" => "%{SYSLOG5424SD} %{IP}() {26 vars in 511 bytes} %{SYSLOG5424SD} GET %{URIPATHPARAM} => generated 28 bytes in 1 msecs (HTTP%{URIPATHPARAM} 200) 2 headers in 79 bytes (1 switches on core 0)" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
stdout { codec => rubydebug }
}
Po uruchomieniu logstash z tego pliku conf, otrzymuję komunikat o błędzie: -
{
"message" => "[pid: 7731|app: 0|req: 357299/357299] ClientIP() {26 vars in 511 bytes} [Sun Mar 1 07:47:32 2015] GET /?file_name=123&start=0&end=30&device_id=abcd&verif_id=xyzsghg => generated 28 bytes in 1 msecs (HTTP/1.0 200) 2 headers in 79 bytes (1 switches on core 0)",
"@version" => "1",
"@timestamp" => "2015-03-01T07:57:02.291Z",
"host" => "cube26-Inspiron-3542",
"tags" => [
[0] "_grokparsefailure"
]
}
Termin został prawidłowo sformatowany. Jak wyodrębnić inne informacje od moich dziennikach, takich jak mój query parameters(filename, start,end, deviceid etc)
i ClientIP
, Response code
itp
także, czy istnieje wbudowaną UWSGI dziennika parsera, który może być użyty, taki jak ten, zbudowany dla apache i syslog?
EDIT
Napisałem to na własną rękę, ale rzuca ten sam błąd:
%{SYSLOG5424SD} %{IP:client_ip}() {%{NUMBER:vars} vars in %{NUMBER:bytes} bytes} %{SYSLOGTIMESTAMP:date} %{WORD:method} %{URIPATHPARAM:request} => generated %{NUMBER:generated_bytes} bytes in {NUMBER:secs} msecs (HTTP/1.0 %{NUMBER:response_code}) %{NUMBER:headers} headers in %{NUMBER:header_bytes} (1 switches on core 0)
EDIT 2
końcu jestem w stanie go złamać sobie. Filtr GROK na powyższym dzienniku będą:
\[pid: %{NUMBER:pid}\|app: %{NUMBER:app}\|req: %{NUMBER:req_num1}/%{NUMBER:req_num2}\] %{IP:client_ip} \(\) \{%{NUMBER:vars} vars in %{NUMBER:bytes} bytes\} %{SYSLOG5424SD} %{WORD:method} /\?file_name\=%{NUMBER:file_name}\&start\=%{NUMBER:start}\&end\=%{NUMBER:end} \=\> generated %{NUMBER:generated_bytes} bytes in %{NUMBER:secs} msecs \(HTTP/1.0 %{NUMBER:response_code}\) %{NUMBER:headers} headers in %{NUMBER:header_bytes}
Ale moje pytania pozostają:
jest jakiś filtr w domyślnym uwsgi grop zalogować ?? **
I Zastosowaliśmy różne dopasowania dla różnych parametrów zapytania. Czy jest coś w grok, który pobiera same parametry zapytania?