Hi for all
I set the logstash filter with following command:
filter {
if [type] == "apache-error" {
grok {
match => ["message", "\[%{WORD:dayname} %{WORD:month} %{DATA:day} %{DATA:hour}:%{DATA:minute}:%{DATA:second} %{YEAR:year}\] \[%{NOTSPACE:loglevel}\] (?:\[client %{IPORHOST:clientip}\] ){0,1}%{GREEDYDATA:message}"]
overwrite => [ "message" ]
}
mutate {
convert => [ "[geoip][coordinates]", "float"]
add_field => {
"time_stamp" => "%{day}/%{month}/%{year}:%{hour}:%{minute}:%{second}"
"clientip" => "%{clientip}"
}
}
geoip {
source => "clientip"
target => "geoip"
add_tag => [ "apache-geoip" ]
database => "/etc/logstash/GeoLiteCity.dat"
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
}
date {
match => ["time_stamp", "dd/MMM/YYYY:HH:mm:ss"]
remove_field => [ "time_stamp","day","dayname","month","hour","minute","second","year"]
}
}
}
however the client ip field can not identify the client IP, so the GeoIP does not work.
Below is the Kibana output
@timestamp November 1st 2016, 16:55:16.968
t@version 1
t_id AVghgkdlw0uQaifig-SL
t_index filebeat-2016.11.01
#_score
t_type apache-error
tbeat.hostname reverse-apache
tbeat.name reverse-apache
?clientip %{clientip}
#count 1
?day 01
?dayname Tue
?fields -
thost reverse-apache
?hour 16
tinput_type log
?loglevel error
tmessage [pid 30606:tid 140550112012032] [client 177.205.104.241:62805] [client 177.205.104.241] ModSecurity: Access denied with code 401 (phase 2). Operator EQ matched 0 at REQUEST_HEADERS. [file "/usr/local/modsecurity/crs/activated_rules/modsecurity_crs_21_protocol_anomalies.conf"] [line "47"] [id "960015"] [rev "1"] [msg "Request Missing an Accept Header"] [severity "NOTICE"] [ver "OWASP_CRS/2.2.9"] [maturity "9"] [accuracy "9"] [tag "OWASP_CRS/PROTOCOL_VIOLATION/MISSING_HEADER_ACCEPT"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [hostname "www.xxx.com"] [uri "/index.php/component/search/"] [unique_id "WBjzHQpC--kAAHeOXa4AAACG"]
Any suggestions for how to resolve this issue?
Thanks.