Wenn ich IIS-Protokolldatei im UTF-8-Format analysiere, bekomme ich unter Fehler und wenn ich Protokolldatei im ANSI-Format analysiere, funktioniert nichts Logstash zeige einfach die Nachricht auf der Konsole "Logstash startup completed" an. Es gibt fast 1000 Dateien auf meinem Server Ich kann nicht jedes Dateiformat von ANSI nach UTF-8 ändern. Kannst du bitte helfen, wo ich in meiner Konfigurationsdatei ändern muss. Ich füge auch eine Debug-Datei an, wenn ich Dateien im UTF-8-Format analysiere. Ich benutze elastische Suche auf der gleichen Box und es funktioniert einwandfrei. Ich bin auch in der Lage, den Port 9200 mit 127.0.0.1 zu telnet.logstash-2.2.2, Windows, IIS-Protokolldateiformat
Log Beispiel:
2016-03-26T05:40:40.764Z WIN-AK44913P759 2016-03-24 00:16:31 W3SVC20 ODSANDBOXWEB01 172.x.x.x GET /healthmonitor.axd - 80 - 172.x.x.x HTTP/1.1 - - - www.xyz.net 200 0 0 4698 122 531
stdout Ausgabe:
{
"message" => "2016-03-24 04:43:02 W3SVC20 ODSANDBOXWEB01 172.x.x.x GET /healthmonitor.axd - 80 - 172.x.x.x HTTP/1.1 - - - www.xyz.net 200 0 0 4698 122 703\r",
"@version" => "1",
"@timestamp" => "2016-03-26T05:42:15.045Z",
"path" => "C:\\IISLogs/u_ex160324.log",
"host" => "WIN-AK44913P759",
"type" => "IISLog",
"tags" => [
[0] "_grokparsefailure"
]
}
Unten finden Sie meine logstash conf Datei Konfiguration
input {
file {
type => "IISLog"
path => "C:\IISLogs/u_ex*.log"
start_position => "beginning"
}
}
filter {
#ignore log comments
if [message] =~ "^#" {
drop {}
}
grok {
match => ["message", "%{TIMESTAMP_ISO8601:log_timestamp} %{WORD:iisSite} %{IPORHOST:site} %{WORD:method} %{URIPATH:page} %{NOTSPACE:querystring} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clienthost} %{NOTSPACE:useragent} %{NOTSPACE:referer} %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:scstatus} %{NUMBER:bytes:int} %{NUMBER:timetaken:int}"]
}
#Set the Event Timesteamp from the log
date {
match => [ "log_timestamp", "YYYY-MM-dd HH:mm:ss" ]
timezone => "Etc/UCT"
}
useragent {
source=> "useragent"
prefix=> "browser"
}
mutate {
remove_field => [ "log_timestamp"]
}
}
# output logs to console and to elasticsearch
output {
stdout {}
elasticsearch {
hosts => ["127.0.0.1:9200"]
}
stdout {
codec => rubydebug
}
}
Hallo Alain, Thansk für das Update. In meinem Fall bedeutet 172.x.x.x das normale IP-Adressformat. Gibt es Hilfe, um Grok-Muster zu erstellen? Ich bin etwas neu mit Elastic Search & Logstash. – Gparmar
Ich wusste, was 172.x.x.x bedeutete, aber da diese Eingabe niemals mit% {IP} übereinstimmt, machst du diejenigen von uns, die dir helfen wollen, mehr zu tun, um dein Muster zu debuggen. Wenn Sie es zu einer anderen gültigen IP geändert hätten, wäre es einfacher zu debuggen. Wie zum Lernen von Grok, vielleicht starten Sie hier: http://svops.com/blog/introduction-to-logstash-grok-patterns/ –