I'm trying to create a module for filebeat. The tests involving test.log
and test.log-expected.json
are failing. I'm having a hard time figuring out why.
Are there files in build
that would give hints? Is there a way to get the test (I'm doing make testsuite
) to save the results of ingesting test.log
so I can compare?
Yes, I know about the grok
debugger(s) available. Testing in logstash
resulted in some fields I want to drop (e.g., host, message, @version). I'm also using the date
processor to use the parsed timestamp from the log as @timestamp. So, I'm not completely sure what fields should appear and in what format (i.e., @timestamp). Being able to see what's generated and compared to test.log-expected.json
would be a huge help.
Many thanks in advance....
P.S. I set up the dev environment within the past few weeks, so the version should be current.
P.P.S. In case it's helpful, here are my ingest/pipeline.json
, test.log
, and test.log-expected.json
:
ingest/pipeline.json
:
{
"description": "Pipeline for parsing module_name request logs",
"processors": [
{
"grok": {
"field": "message",
"patterns": [
"%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \\[%{HTTPDATE:timestamp}\\] \"(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})\" %{NUMBER:response} (?:%{NUMBER:resp_time_ms:integer}|-) (?:%{NUMBER:bytes:integer}|-)"
]
}
},
{
"date" : {
"field" : "timestamp",
"formats" : ["dd/MMM/yyyy:HH:mm:ss Z"]
}
},
{
"remove": {
"field": ["message", "@version", "host", "timestamp"]
}
}
],
"on_failure" : [{
"set" : {
"field" : "error.message",
"value" : "{{ _ingest.on_failure_message }}"
}
}]
}
test.log
:
4.79.43.180 - - [24/Dec/2019:18:35:04 +0000] "GET /poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2 HTTP/1.1" 200 11 30002
4.79.43.180 - - [24/Dec/2019:18:35:34 +0000] "GET /poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2 HTTP/1.1" 200 11 30002
4.79.43.180 - - [24/Dec/2019:18:36:04 +0000] "GET /poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2 HTTP/1.1" 200 11 30001
4.79.43.180 - - [24/Dec/2019:18:36:34 +0000] "GET /poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2 HTTP/1.1" 200 11 30001
4.79.43.180 - - [24/Dec/2019:18:37:04 +0000] "GET /poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2 HTTP/1.1" 200 11 30001
test.log-expected.json
:
[
{
"verb": "GET",
"ident": "-",
"resp_time_ms": 11,
"bytes": 30002,
"httpversion": "1.1",
"request": "/poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2",
"@timestamp": "2019-12-24T18:35:04Z",
"auth": "-",
"clientip": "4.79.43.180",
"response": "200"
},
{
"verb": "GET",
"ident": "-",
"resp_time_ms": 11,
"bytes": 30002,
"httpversion": "1.1",
"request": "/poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2",
"@timestamp": "2019-12-24T18:35:34Z",
"auth": "-",
"clientip": "4.79.43.180",
"response": "200"
},
{
"verb": "GET",
"ident": "-",
"resp_time_ms": 11,
"bytes": 30001,
"httpversion": "1.1",
"request": "/poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2",
"@timestamp": "2019-12-24T18:36:04Z",
"auth": "-",
"clientip": "4.79.43.180",
"response": "200"
},
{
"verb": "GET",
"ident": "-",
"resp_time_ms": 11,
"bytes": 30001,
"httpversion": "1.1",
"request": "/poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2",
"@timestamp": "2019-12-24T18:36:34Z",
"auth": "-",
"clientip": "4.79.43.180",
"response": "200"
},
{
"verb": "GET",
"ident": "-",
"resp_time_ms": 11,
"bytes": 30001,
"httpversion": "1.1",
"request": "/poll.rest?userId=10637&muxId=4P7OKlCVKTXBOgfP&seq=2",
"@timestamp": "2019-12-24T18:37:04Z",
"auth": "-",
"clientip": "4.79.43.180",
"response": "200"
}
]