im use 2 grok filter to one config file but not worked !!!
input {
beats {
port => 5443
type => syslog
ssl => true
ssl_certificate => "/etc/logstash/logstash.crt"
ssl_key => "/etc/logstash/logstash.key"
}
}
filter {
if [type] == "log" {
grok {
patterns_dir => "/etc/logstash/patterns"
match => { "%{IP:client} %{HTTPDUSER:ident} %{USER:auth} \[%{HTTPDATE:timestamp_server_genaration}\] \"%{WORD:method} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:status_code} %{NUMBER:bytes} %{QS:refferer} %{QS:user_agent} length %{NUMBER:length} rtime %{NUMBER:request_time} uri %{URIPATHPARAM:uri} realip %{IP:realip}" }
remove_tag => ["nginx_access", "_grokparsefailure"] }
add_field => {
"type" => "nginx_access"
}
remove_field => ["log"]
}
}
date {
match => ["time_local", "dd/MMM/YYYY:HH:mm:ss Z"]
target => "@timestamp"
remove_field => "time_local"
}
if [type] == "log" {
grok {
patterns_dir => "/etc/logstash/patterns"
match => { (?<timestamp>%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}[- ]%{TIME}) \[%{LOGLEVEL:severity}\] %{POSINT:pid}#%{NUMBER}:%{GREEDYDATA:errormessage} }
remove_tag => ["nginx_error", "_grokparsefailure"] }
add_field => {
"type" => "nginx_error"
}
remove_field => ["log"]
}
date {
match => ["time_local", "YYYY/MM/dd HH:mm:ss"]
target => "@timestamp"
remove_field => "time_local"
}
output {
elasticsearch { hosts => ["localhost:9200"]
hosts => "localhost:9200"
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
}