forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support haproxy log lines without captured headers (elastic#9958) (el…
…astic#9969) Haproxy can capture headers from http requests and responses and log them. This is not done by default but current filebeat module expects it. Make captured headers optional, and collect them only if both request and response headers are configured. If only one is configured, the log is parsed but headers not collected as we cannot know if they are request or response headers. (cherry picked from commit 8e21bd2)
- Loading branch information
Showing
4 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Dec 10 12:01:46 voyager haproxy[19312]: 127.0.0.1:35982 [10/Dec/2018:12:01:46.395] http-webservices http-webservices/<NOSRV> 0/-1/-1/-1/0 503 213 - - SC-- 1/1/0/0/0 0/0 "GET / HTTP/1.1" | ||
Dec 10 15:46:49 voyager haproxy[29785]: 127.0.0.1:43738 [10/Dec/2018:15:46:49.497] http-webservices http-webservices/<NOSRV> 0/-1/-1/-1/0 503 213 - - SC-- 1/1/0/0/0 0/0 {localhost:8888||} "GET /foo HTTP/1.1" | ||
Dec 10 15:48:56 voyager haproxy[7873]: 127.0.0.1:44542 [10/Dec/2018:15:48:56.017] http-webservices http-webservices/<NOSRV> 0/-1/-1/-1/0 503 213 - - SC-- 1/1/0/0/0 0/0 {localhost:8888||} {|} "GET /foo HTTP/1.1" | ||
|
105 changes: 105 additions & 0 deletions
105
filebeat/module/haproxy/log/test/httplog-no-headers.log-expected.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
[ | ||
{ | ||
"event.dataset": "haproxy.log", | ||
"fileset.module": "haproxy", | ||
"fileset.name": "log", | ||
"haproxy.backend_name": "http-webservices", | ||
"haproxy.backend_queue": 0, | ||
"haproxy.bytes_read": 213, | ||
"haproxy.client.ip": "127.0.0.1", | ||
"haproxy.client.port": 35982, | ||
"haproxy.connection_wait_time_ms": -1, | ||
"haproxy.connections.active": 1, | ||
"haproxy.connections.backend": 0, | ||
"haproxy.connections.frontend": 1, | ||
"haproxy.connections.retries": 0, | ||
"haproxy.connections.server": 0, | ||
"haproxy.frontend_name": "http-webservices", | ||
"haproxy.http.request.captured_cookie": "-", | ||
"haproxy.http.request.raw_request_line": "GET / HTTP/1.1", | ||
"haproxy.http.request.time_active_ms": 0, | ||
"haproxy.http.request.time_wait_ms": 0, | ||
"haproxy.http.request.time_wait_without_data_ms": -1, | ||
"haproxy.http.response.captured_cookie": "-", | ||
"haproxy.http.response.status_code": 503, | ||
"haproxy.pid": 19312, | ||
"haproxy.process_name": "haproxy", | ||
"haproxy.server_name": "<NOSRV>", | ||
"haproxy.server_queue": 0, | ||
"haproxy.termination_state": "SC--", | ||
"haproxy.total_waiting_time_ms": -1, | ||
"input.type": "log", | ||
"offset": 0, | ||
"prospector.type": "log" | ||
}, | ||
{ | ||
"event.dataset": "haproxy.log", | ||
"fileset.module": "haproxy", | ||
"fileset.name": "log", | ||
"haproxy.backend_name": "http-webservices", | ||
"haproxy.backend_queue": 0, | ||
"haproxy.bytes_read": 213, | ||
"haproxy.client.ip": "127.0.0.1", | ||
"haproxy.client.port": 43738, | ||
"haproxy.connection_wait_time_ms": -1, | ||
"haproxy.connections.active": 1, | ||
"haproxy.connections.backend": 0, | ||
"haproxy.connections.frontend": 1, | ||
"haproxy.connections.retries": 0, | ||
"haproxy.connections.server": 0, | ||
"haproxy.frontend_name": "http-webservices", | ||
"haproxy.http.request.captured_cookie": "-", | ||
"haproxy.http.request.raw_request_line": "GET /foo HTTP/1.1", | ||
"haproxy.http.request.time_active_ms": 0, | ||
"haproxy.http.request.time_wait_ms": 0, | ||
"haproxy.http.request.time_wait_without_data_ms": -1, | ||
"haproxy.http.response.captured_cookie": "-", | ||
"haproxy.http.response.status_code": 503, | ||
"haproxy.pid": 29785, | ||
"haproxy.process_name": "haproxy", | ||
"haproxy.server_name": "<NOSRV>", | ||
"haproxy.server_queue": 0, | ||
"haproxy.termination_state": "SC--", | ||
"haproxy.total_waiting_time_ms": -1, | ||
"input.type": "log", | ||
"offset": 186, | ||
"prospector.type": "log" | ||
}, | ||
{ | ||
"event.dataset": "haproxy.log", | ||
"fileset.module": "haproxy", | ||
"fileset.name": "log", | ||
"haproxy.backend_name": "http-webservices", | ||
"haproxy.backend_queue": 0, | ||
"haproxy.bytes_read": 213, | ||
"haproxy.client.ip": "127.0.0.1", | ||
"haproxy.client.port": 44542, | ||
"haproxy.connection_wait_time_ms": -1, | ||
"haproxy.connections.active": 1, | ||
"haproxy.connections.backend": 0, | ||
"haproxy.connections.frontend": 1, | ||
"haproxy.connections.retries": 0, | ||
"haproxy.connections.server": 0, | ||
"haproxy.frontend_name": "http-webservices", | ||
"haproxy.http.request.captured_cookie": "-", | ||
"haproxy.http.request.captured_headers": [ | ||
"localhost:8888" | ||
], | ||
"haproxy.http.request.raw_request_line": "GET /foo HTTP/1.1", | ||
"haproxy.http.request.time_active_ms": 0, | ||
"haproxy.http.request.time_wait_ms": 0, | ||
"haproxy.http.request.time_wait_without_data_ms": -1, | ||
"haproxy.http.response.captured_cookie": "-", | ||
"haproxy.http.response.captured_headers": [], | ||
"haproxy.http.response.status_code": 503, | ||
"haproxy.pid": 7873, | ||
"haproxy.process_name": "haproxy", | ||
"haproxy.server_name": "<NOSRV>", | ||
"haproxy.server_queue": 0, | ||
"haproxy.termination_state": "SC--", | ||
"haproxy.total_waiting_time_ms": -1, | ||
"input.type": "log", | ||
"offset": 394, | ||
"prospector.type": "log" | ||
} | ||
] |