Last active
April 10, 2020 21:05
-
-
Save hslavich/d1fdecd80824b04fb922f90c6ea3efe6 to your computer and use it in GitHub Desktop.
Logstash filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter { | |
if [type] == "apache_access" { | |
grok { | |
match => { "message" => "%{COMBINEDAPACHELOG}" } | |
} | |
date { | |
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ] | |
} | |
} | |
} | |
filter { | |
if [type] == "apache_error" { | |
grok { | |
match => { "message" => "\[%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}\] \[:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? PHP %{DATA:php_error_level}: %{DATA:php_error} in %{DATA:php_file} on line %{POSINT:php_line}" } | |
} | |
grok { | |
match => { "message" => "\[%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}\] \[:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? %{GREEDYDATA:message}" } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter { | |
if [format] == "symfony" { | |
grok { | |
match => { | |
"message" => "\[%{TIMESTAMP_ISO8601:timestamp}\] %{DATA:context}\.%{LOGLEVEL:level}:" | |
} | |
} | |
date { | |
match => ["timestamp", "yyyy-MM-dd HH:mm:ss"] | |
timezone => "America/Argentina/Buenos_Aires" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter { | |
if [format] == "toba" { | |
grok { | |
match => { | |
"message" => [ | |
"Fecha: (?<fecha>%{DATE_EU} %{TIME})", | |
"Operacion: (?<operacion>[^\r\n]*)", | |
"Usuario: (?<usuario>[^\r\n]*)", | |
"Host: %{IP:host}", | |
"Servidor: (?<servidor>[^\r\n]*)", | |
"Version-PHP: (?<php>[^\r\n]*)", | |
"URI: (?<uri>[^\r\n]*)", | |
"==========[\r\n]%{GREEDYDATA:message}" | |
] | |
} | |
overwrite => [ "message" ] | |
break_on_match => false | |
} | |
date { | |
match => ["fecha", "dd-MM-yyyy HH:mm:ss"] | |
timezone => "America/Argentina/Buenos_Aires" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment