edit: read below for update to initial question
I'm getting Provided Grok expressions do not match field value
even though _simulate
works with exact same string.
Error message:
"message": "172.18.0.2 - - [12/Aug/2019:01:20:27 +0000] \"GET /censored HTTP/1.1\" 200 457049 \"http://censored.com/censored\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\"",
"error": {
"message": "Provided Grok expressions do not match field value: [172.18.0.2 - - [12/Aug/2019:01:20:27 +0000] \\\"GET /censored HTTP/1.1\\\" 200 457049 \\\"http://censored.com/censored\\\" \\\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\\\"]"
},
The pipeline is standard nginx filebeat
$ curl -XGET -u elastic:censored 'http://127.0.0.1:9200/_ingest/pipeline/filebeat-7.3.0-nginx-access-default?pretty'
{
"filebeat-7.3.0-nginx-access-default" : {
"description" : "Pipeline for parsing Nginx access logs. Requires the geoip and user_agent plugins.",
"processors" : [
{
"grok" : {
"field" : "message",
"patterns" : [
"\"?(?:%{IP_LIST:nginx.access.remote_ip_list}|%{DATA:source.address}) - %{DATA:user.name} \\[%{HTTPDATE:nginx.access.time}\\] \"%{DATA:nginx.access.info}\" %{NUMBER:http.response.status_code:long} %{NUMBER:http.response.body.bytes:long} \"%{DATA:http.request.referrer}\" \"%{DATA:user_agent.original}\""
],
"pattern_definitions" : {
"IP_LIST" : "%{IP}(\"?,?\\s*%{IP})*"
},
"ignore_missing" : true
}
},
.....
But it works fine if I simulate such message:
$ cat data.json
{"docs" : [{ "_source": {"message": "172.18.0.2 - - [12/Aug/2019:01:20:27 +0000] \"GET /censored HTTP/1.1\" 200 457049 \"http://censored.com/censored\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\""} }]}
$ curl -XPOST -u elastic:censored -d '@data.json' 'http://127.0.0.1:9200/_ingest/pipeline/filebeat-7.3.0-nginx-access-default/_simulate?pretty' --header "Content-Type:application/json"
{
"docs" : [
{
"doc" : {
"_index" : "_index",
===== correctly parsed document below =====
It collects logs from docker:
filebeat.autodiscover:
providers:
- type: docker
hints.enabled: true
processors:
- add_cloud_metadata: ~
- add_docker_metadata: ~
- add_locale:
format: offset
- add_host_metadata:
netinfo.enabled: true
output.elasticsearch:
hosts: ['elasticsearch:9200']
protocol: "http"
username: elastic
password: censored
What I might be missing?