Hi guys,
I'm trying to use the elk to generate dashboards of apache access logs.
However I can't split up in various fields the message field.
It turns out that my apache access logs are a little customized because I use the AJP Protocol and need some additional information in the log.
The APACHECOMBINED filter does not work for me because the log is customized.
I'm generating the logs in apache that way:
LogFormat "%v %h \"%{BALANCER_WORKER_NAME}e\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D %I %O" vhost_ajp_worker_name
the log appears in this way:
vhost.domain.com 172.28.146.75 "ajp://internalserver.domain.local" - - [11/Jul/2017:23:03:58 -0300] "POST /1g/Processo/ConsultaProcesso/Detalhe/detalheProcessoVisualizacao.seam HTTP/1.1" 200 722 "https://internalserver.domain.local/1g/Processo/ConsultaProcesso/Detalhe/detalheProcessoVisualizacao.seam?id=978617&ca=ba8f7f19f16ac79696cb5ba871212278c97529e33e0d5e29ec93d9c2b7eedafa2bab2c8b14ba63bc22bae4dd465f99927d7b339e4eaafcf4&idTaskInstance=290637995" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0" 87720 1588 1481
I tried to change anyway the filter but can't make the fields that are in "message" in fields outside:
example of grok trying:
"message" => '%{WORD:VirtualHost} %{IPORHOST:clientip} %{QS:BALANCER_WORKER_NAME} %{WORD:remote_log_name} %{WORD:user} \[%{HTTPDATE:timestamp}\] \"%{WORD:Method} %{DATA:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:response:int} %{NUMBER:Response_size:int} %{QS:referrer} %{QS:agent} %{NUMBER:Time_taken:int} %{NUMBER:bytes_received:int} %{NUMBER:bytes_sents:int}'
My file apache.conf:
input {
stdin { }
}
filter {
if [type] == "apache" {
grok {
match => { "message" => '%{WORD:VirtualHost} %{IPORHOST:clientip} \"%{WORD:balancer_worker}\" %{WORD:remote_log_name} %{WORD:user} \[%{HTTPDAT
E:timestamp}\] \"%{WORD:Method} %{DATA:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:response} %{NUMBER:Response_size} \"%{WORD:referrer}\" \"%{WOR
D:agent}\" %{NUMBER:Time_taken} %{NUMBER:bytes_received} %{NUMBER:bytes_sents}'
}
}
date {
match => [ "timestamp", "dd/MMM/YYYY:HH:mm:ss Z" ]
}
geoip {
source => "clientip"
}
}
}
output {
elasticsearch { hosts => ["localhost:9200"]}
stdout { codec => rubydebug}
}
The logs being displayed in kibana without the message field divided into several: