Skip to content

Commit 23e0742

Browse files
jsorianowixaw
andauthored
Cherry-pick elastic#12695 to 7.1: Add support for client addresses with port in Apache error logs (elastic#12730)
Client addresses can contain the port in the default log format, add support for this. (cherry picked from commit b81c58c) Co-authored-by: William VINCENT <willouuu@gmail.com>
1 parent 482bb9e commit 23e0742

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ https://github.com/elastic/beats/compare/v7.1.1...7.1[Check the HEAD diff]
4848
- Fix goroutine leak on non-explicit finalization of log input. {pull}12164[12164]
4949
- Require client_auth by default when ssl is enabled for tcp input {pull}12333[12333]
5050
- When TLS is configured for the TCP input and a `certificate_authorities` is configured we now default to `required` for the `client_authentication`. {pull}12584[12584]
51+
- Add support for client addresses with port in Apache error logs {pull}12695[12695]
5152

5253
*Heartbeat*
5354

filebeat/module/apache/error/ingest/pipeline.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"grok": {
66
"field": "message",
77
"patterns": [
8-
"\\[%{APACHE_TIME:apache.error.timestamp}\\] \\[%{LOGLEVEL:log.level}\\]( \\[client %{IPORHOST:source.address}\\])? %{GREEDYDATA:message}",
9-
"\\[%{APACHE_TIME:apache.error.timestamp}\\] \\[%{DATA:apache.error.module}:%{LOGLEVEL:log.level}\\] \\[pid %{NUMBER:process.pid:long}(:tid %{NUMBER:process.thread.id:long})?\\]( \\[client %{IPORHOST:source.address}\\])? %{GREEDYDATA:message}"
8+
"\\[%{APACHE_TIME:apache.error.timestamp}\\] \\[%{LOGLEVEL:log.level}\\]( \\[client %{IPORHOST:source.address}(:%{POSINT:source.port})?\\])? %{GREEDYDATA:message}",
9+
"\\[%{APACHE_TIME:apache.error.timestamp}\\] \\[%{DATA:apache.error.module}:%{LOGLEVEL:log.level}\\] \\[pid %{NUMBER:process.pid:long}(:tid %{NUMBER:process.thread.id:long})?\\]( \\[client %{IPORHOST:source.address}(:%{POSINT:source.port})?\\])? %{GREEDYDATA:message}"
1010
],
1111
"pattern_definitions": {
1212
"APACHE_TIME": "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[Mon Dec 26 16:22:08 2016] [error] [client 192.168.33.1] File does not exist: /var/www/favicon.ico
22
[Mon Dec 26 16:15:55.103786 2016] [core:notice] [pid 11379] AH00094: Command line: '/usr/local/Cellar/httpd24/2.4.23_2/bin/httpd'
33
[Fri Sep 09 10:42:29.902022 2011] [core:error] [pid 35708:tid 4328636416] [client 72.15.99.187] File does not exist: /usr/local/apache2/htdocs/favicon.ico
4+
[Thu Jun 27 06:58:09.169510 2019] [include:warn] [pid 15934] [client 123.123.123.123:12345] AH01374: mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed: /test.html

filebeat/module/apache/error/test/test.log-expected.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,29 @@
5050
"source.geo.region_iso_code": "US-GA",
5151
"source.geo.region_name": "Georgia",
5252
"source.ip": "72.15.99.187"
53+
},
54+
{
55+
"@timestamp": "2019-06-27T06:58:09.169Z",
56+
"apache.error.module": "include",
57+
"ecs.version": "1.0.0",
58+
"event.dataset": "apache.error",
59+
"event.module": "apache",
60+
"fileset.name": "error",
61+
"input.type": "log",
62+
"log.level": "warn",
63+
"log.offset": 384,
64+
"message": "AH01374: mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed: /test.html",
65+
"process.pid": 15934,
66+
"service.type": "apache",
67+
"source.address": "123.123.123.123",
68+
"source.geo.city_name": "Beijing",
69+
"source.geo.continent_name": "Asia",
70+
"source.geo.country_iso_code": "CN",
71+
"source.geo.location.lat": 39.9288,
72+
"source.geo.location.lon": 116.3889,
73+
"source.geo.region_iso_code": "CN-BJ",
74+
"source.geo.region_name": "Beijing",
75+
"source.ip": "123.123.123.123",
76+
"source.port": "12345"
5377
}
5478
]

0 commit comments

Comments
 (0)