Skip to content

Commit

Permalink
Filebeat modules now use .address fields for ambiguous address value (e…
Browse files Browse the repository at this point in the history
…lastic#10141)

The `source.address` field is used prior to extracting IP or domain, when an event source can contain either.

Migrated:

* `apache2.access.remote_ip` => `source.address`
  * Note that the renamed apache module has not been released yet, so the field `apache.access.remote_ip` was simply removed.
* `haproxy.client.ip` => `source.address`
  • Loading branch information
webmat authored Jan 18, 2019
1 parent eee0c50 commit 4a837b7
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 48 deletions.
8 changes: 8 additions & 0 deletions dev-tools/ecs-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@

## Apache module

- from: apache2.access.remote_ip
to: source.address
alias: true

- from: apache2.access.user_name
to: user.name
alias: true
Expand Down Expand Up @@ -424,6 +428,10 @@

## HAProxy module

- from: haproxy.client.ip
to: source.address
alias: true

- from: haproxy.client.port
to: source.port
alias: true
Expand Down
16 changes: 3 additions & 13 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Aliases for backward compatibility with old apache2 fields
--
type: alias
alias to: apache.access.remote_ip
alias to: source.address
--
Expand Down Expand Up @@ -363,16 +363,6 @@ Contains fields for the Apache HTTP Server access logs.
*`apache.access.remote_ip`*::
+
--
type: keyword
Client IP address or hostname.
--
*`apache.access.ssl.protocol`*::
+
--
Expand Down Expand Up @@ -4742,9 +4732,9 @@ Information about the client doing the request
*`haproxy.client.ip`*::
+
--
IP address of the client which initiated the TCP connection to haproxy.
If connection is via unix socket, socket path is in this field.
type: alias
alias to: source.address
--
Expand Down
2 changes: 1 addition & 1 deletion filebeat/module/apache/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
fields:
- name: remote_ip
type: alias
path: apache.access.remote_ip
path: source.address
migration: true
- name: ssl.protocol
type: alias
Expand Down
5 changes: 0 additions & 5 deletions filebeat/module/apache/access/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
description: >
Contains fields for the Apache HTTP Server access logs.
fields:
- name: remote_ip
type: keyword
description: >
Client IP address or hostname.
- name: ssl.protocol
type: keyword
description: >
Expand Down
8 changes: 4 additions & 4 deletions filebeat/module/apache/access/ingest/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"grok": {
"field": "message",
"patterns":[
"%{IPORHOST:apache.access.remote_ip} - %{DATA:user.name} \\[%{HTTPDATE:apache.access.time}\\] \"%{WORD:http.request.method} %{DATA:url.original} HTTP/%{NUMBER:http.version}\" %{NUMBER:http.response.status_code:long} (?:%{NUMBER:apache.access.body_sent.bytes:long}|-)( \"%{DATA:http.request.referrer}\")?( \"%{DATA:apache.access.agent}\")?",
"%{IPORHOST:apache.access.remote_ip} - %{DATA:user.name} \\[%{HTTPDATE:apache.access.time}\\] \"-\" %{NUMBER:http.response.status_code:long} -",
"\\[%{HTTPDATE:apache.access.time}\\] %{IPORHOST:apache.access.remote_ip} %{DATA:apache.access.ssl.protocol} %{DATA:apache.access.ssl.cipher} \"%{WORD:http.request.method} %{DATA:url.original} HTTP/%{NUMBER:http.version}\" %{NUMBER:apache.access.body_sent.bytes}"
"%{IPORHOST:source.address} - %{DATA:user.name} \\[%{HTTPDATE:apache.access.time}\\] \"%{WORD:http.request.method} %{DATA:url.original} HTTP/%{NUMBER:http.version}\" %{NUMBER:http.response.status_code:long} (?:%{NUMBER:apache.access.body_sent.bytes:long}|-)( \"%{DATA:http.request.referrer}\")?( \"%{DATA:apache.access.agent}\")?",
"%{IPORHOST:source.address} - %{DATA:user.name} \\[%{HTTPDATE:apache.access.time}\\] \"-\" %{NUMBER:http.response.status_code:long} -",
"\\[%{HTTPDATE:apache.access.time}\\] %{IPORHOST:source.address} %{DATA:apache.access.ssl.protocol} %{DATA:apache.access.ssl.cipher} \"%{WORD:http.request.method} %{DATA:url.original} HTTP/%{NUMBER:http.version}\" %{NUMBER:apache.access.body_sent.bytes}"
],
"ignore_missing": true
}
Expand All @@ -16,7 +16,7 @@
}
}, {
"grok": {
"field": "apache.access.remote_ip",
"field": "source.address",
"ignore_missing": true,
"patterns": [
"^(%{IP:source.ip}|%{HOSTNAME:source.domain})$"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
"@timestamp": "2018-08-10T07:45:56.000Z",
"apache.access.body_sent.bytes": "1375",
"apache.access.remote_ip": "172.30.0.119",
"apache.access.ssl.cipher": "ECDHE-RSA-AES128-GCM-SHA256",
"apache.access.ssl.protocol": "TLSv1.2",
"ecs.version": "1.0.0-beta2",
Expand All @@ -14,6 +13,7 @@
"input.type": "log",
"log.offset": 0,
"service.type": "apache",
"source.address": "172.30.0.119",
"source.ip": "172.30.0.119",
"url.original": "/nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_admin_tasks_html%22%2C%22args%22%3A%22%22%7D&nsp=b5c7d5d4b6f7d0cf0c92f9cbdf737f6a5c838218425e6ae21"
}
Expand Down
10 changes: 5 additions & 5 deletions filebeat/module/apache/access/test/test.log-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
"@timestamp": "2016-12-26T14:16:29.000Z",
"apache.access.body_sent.bytes": 209,
"apache.access.remote_ip": "::1",
"ecs.version": "1.0.0-beta2",
"event.dataset": "apache.access",
"event.module": "apache",
Expand All @@ -13,14 +12,14 @@
"input.type": "log",
"log.offset": 0,
"service.type": "apache",
"source.address": "::1",
"source.ip": "::1",
"url.original": "/favicon.ico",
"user.name": "-"
},
{
"@timestamp": "2016-12-26T16:22:13.000Z",
"apache.access.body_sent.bytes": 499,
"apache.access.remote_ip": "192.168.33.1",
"ecs.version": "1.0.0-beta2",
"event.dataset": "apache.access",
"event.module": "apache",
Expand All @@ -32,6 +31,7 @@
"input.type": "log",
"log.offset": 73,
"service.type": "apache",
"source.address": "192.168.33.1",
"source.ip": "192.168.33.1",
"url.original": "/hello",
"user.name": "-",
Expand All @@ -47,7 +47,6 @@
},
{
"@timestamp": "2016-12-26T14:16:48.000Z",
"apache.access.remote_ip": "::1",
"ecs.version": "1.0.0-beta2",
"event.dataset": "apache.access",
"event.module": "apache",
Expand All @@ -56,13 +55,13 @@
"input.type": "log",
"log.offset": 238,
"service.type": "apache",
"source.address": "::1",
"source.ip": "::1",
"user.name": "-"
},
{
"@timestamp": "2017-05-29T19:02:48.000Z",
"apache.access.body_sent.bytes": 612,
"apache.access.remote_ip": "172.17.0.1",
"ecs.version": "1.0.0-beta2",
"event.dataset": "apache.access",
"event.module": "apache",
Expand All @@ -74,6 +73,7 @@
"input.type": "log",
"log.offset": 285,
"service.type": "apache",
"source.address": "172.17.0.1",
"source.ip": "172.17.0.1",
"url.original": "/stringpatch",
"user.name": "-",
Expand All @@ -89,7 +89,6 @@
{
"@timestamp": "2017-05-29T19:02:48.000Z",
"apache.access.body_sent.bytes": 612,
"apache.access.remote_ip": "monitoring-server",
"ecs.version": "1.0.0-beta2",
"event.dataset": "apache.access",
"event.module": "apache",
Expand All @@ -101,6 +100,7 @@
"input.type": "log",
"log.offset": 443,
"service.type": "apache",
"source.address": "monitoring-server",
"source.domain": "monitoring-server",
"url.original": "/status",
"user.name": "-",
Expand Down
2 changes: 1 addition & 1 deletion filebeat/module/apache/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions filebeat/module/haproxy/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@
type: group
fields:
- name: ip
description: >
IP address of the client which initiated the TCP connection to haproxy.
If connection is via unix socket, socket path is in this field.
type: alias
path: source.address
migration: true
- name: port
type: alias
path: source.port
Expand Down
2 changes: 1 addition & 1 deletion filebeat/module/haproxy/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions filebeat/module/haproxy/log/ingest/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"grok": {
"field": "message",
"patterns": [
"%{HAPROXY_DATE:haproxy.request_date} %{IPORHOST:haproxy.source} %{PROG:process.name}(?:\\[%{POSINT:process.pid:long}\\])?: %{GREEDYDATA} %{IPORHOST:haproxy.client.ip}:%{POSINT:source.port:long} %{WORD} %{IPORHOST:destination.ip}:%{POSINT:destination.port:long} \\(%{WORD:haproxy.frontend_name}/%{WORD:haproxy.mode}\\)",
"%{HAPROXY_DATE:haproxy.request_date} %{IPORHOST:haproxy.source} %{PROG:process.name}(?:\\[%{POSINT:process.pid:long}\\])?: %{GREEDYDATA} %{IPORHOST:source.address}:%{POSINT:source.port:long} %{WORD} %{IPORHOST:destination.ip}:%{POSINT:destination.port:long} \\(%{WORD:haproxy.frontend_name}/%{WORD:haproxy.mode}\\)",

"(%{NOTSPACE:process.name}\\[%{NUMBER:process.pid:long}\\]: )?%{IP:haproxy.client.ip}:%{NUMBER:source.port:long} \\[%{NOTSPACE:haproxy.request_date}\\] %{NOTSPACE:haproxy.frontend_name} %{NOTSPACE:haproxy.backend_name}/%{NOTSPACE:haproxy.server_name} %{NUMBER:haproxy.http.request.time_wait_ms:long}/%{NUMBER:haproxy.total_waiting_time_ms:long}/%{NUMBER:haproxy.connection_wait_time_ms:long}/%{NUMBER:haproxy.http.request.time_wait_without_data_ms:long}/%{NUMBER:haproxy.http.request.time_active_ms:long} %{NUMBER:http.response.status_code:long} %{NUMBER:haproxy.bytes_read:long} %{NOTSPACE:haproxy.http.request.captured_cookie} %{NOTSPACE:haproxy.http.response.captured_cookie} %{NOTSPACE:haproxy.termination_state} %{NUMBER:haproxy.connections.active:long}/%{NUMBER:haproxy.connections.frontend:long}/%{NUMBER:haproxy.connections.backend:long}/%{NUMBER:haproxy.connections.server:long}/%{NUMBER:haproxy.connections.retries:long} %{NUMBER:haproxy.server_queue:long}/%{NUMBER:haproxy.backend_queue:long} (\\{%{DATA:haproxy.http.request.captured_headers}\\} \\{%{DATA:haproxy.http.response.captured_headers}\\} |\\{%{DATA}\\} )?\"%{GREEDYDATA:haproxy.http.request.raw_request_line}\"",
"(%{NOTSPACE:process.name}\\[%{NUMBER:process.pid:long}\\]: )?%{IP:source.address}:%{NUMBER:source.port:long} \\[%{NOTSPACE:haproxy.request_date}\\] %{NOTSPACE:haproxy.frontend_name} %{NOTSPACE:haproxy.backend_name}/%{NOTSPACE:haproxy.server_name} %{NUMBER:haproxy.http.request.time_wait_ms:long}/%{NUMBER:haproxy.total_waiting_time_ms:long}/%{NUMBER:haproxy.connection_wait_time_ms:long}/%{NUMBER:haproxy.http.request.time_wait_without_data_ms:long}/%{NUMBER:haproxy.http.request.time_active_ms:long} %{NUMBER:http.response.status_code:long} %{NUMBER:haproxy.bytes_read:long} %{NOTSPACE:haproxy.http.request.captured_cookie} %{NOTSPACE:haproxy.http.response.captured_cookie} %{NOTSPACE:haproxy.termination_state} %{NUMBER:haproxy.connections.active:long}/%{NUMBER:haproxy.connections.frontend:long}/%{NUMBER:haproxy.connections.backend:long}/%{NUMBER:haproxy.connections.server:long}/%{NUMBER:haproxy.connections.retries:long} %{NUMBER:haproxy.server_queue:long}/%{NUMBER:haproxy.backend_queue:long} (\\{%{DATA:haproxy.http.request.captured_headers}\\} \\{%{DATA:haproxy.http.response.captured_headers}\\} |\\{%{DATA}\\} )?\"%{GREEDYDATA:haproxy.http.request.raw_request_line}\"",

"(%{NOTSPACE:process.name}\\[%{NUMBER:process.pid:long}\\]: )?%{IP:haproxy.client.ip}:%{NUMBER:source.port:long} \\[%{NOTSPACE:haproxy.request_date}\\] %{NOTSPACE:haproxy.frontend_name}/%{NOTSPACE:haproxy.bind_name} %{GREEDYDATA:haproxy.error_message}",
"(%{NOTSPACE:process.name}\\[%{NUMBER:process.pid:long}\\]: )?%{IP:source.address}:%{NUMBER:source.port:long} \\[%{NOTSPACE:haproxy.request_date}\\] %{NOTSPACE:haproxy.frontend_name}/%{NOTSPACE:haproxy.bind_name} %{GREEDYDATA:haproxy.error_message}",

"%{HAPROXY_DATE} %{IPORHOST:haproxy.source} (%{NOTSPACE:process.name}\\[%{NUMBER:process.pid:long}\\]: )?%{IP:haproxy.client.ip}:%{NUMBER:source.port:long} \\[%{NOTSPACE:haproxy.request_date}\\] %{NOTSPACE:haproxy.frontend_name} %{NOTSPACE:haproxy.backend_name}/%{NOTSPACE:haproxy.server_name} %{NUMBER:haproxy.total_waiting_time_ms:long}/%{NUMBER:haproxy.connection_wait_time_ms:long}/%{NUMBER:haproxy.tcp.processing_time_ms:long} %{NUMBER:haproxy.bytes_read:long} %{NOTSPACE:haproxy.termination_state} %{NUMBER:haproxy.connections.active:long}/%{NUMBER:haproxy.connections.frontend:long}/%{NUMBER:haproxy.connections.backend:long}/%{NUMBER:haproxy.connections.server:long}/%{NUMBER:haproxy.connections.retries:long} %{NUMBER:haproxy.server_queue:long}/%{NUMBER:haproxy.backend_queue:long}"
"%{HAPROXY_DATE} %{IPORHOST:haproxy.source} (%{NOTSPACE:process.name}\\[%{NUMBER:process.pid:long}\\]: )?%{IP:source.address}:%{NUMBER:source.port:long} \\[%{NOTSPACE:haproxy.request_date}\\] %{NOTSPACE:haproxy.frontend_name} %{NOTSPACE:haproxy.backend_name}/%{NOTSPACE:haproxy.server_name} %{NUMBER:haproxy.total_waiting_time_ms:long}/%{NUMBER:haproxy.connection_wait_time_ms:long}/%{NUMBER:haproxy.tcp.processing_time_ms:long} %{NUMBER:haproxy.bytes_read:long} %{NOTSPACE:haproxy.termination_state} %{NUMBER:haproxy.connections.active:long}/%{NUMBER:haproxy.connections.frontend:long}/%{NUMBER:haproxy.connections.backend:long}/%{NUMBER:haproxy.connections.server:long}/%{NUMBER:haproxy.connections.retries:long} %{NUMBER:haproxy.server_queue:long}/%{NUMBER:haproxy.backend_queue:long}"
],
"ignore_missing": false,
"pattern_definitions": {
Expand Down Expand Up @@ -41,10 +41,10 @@
},
{
"grok": {
"field": "haproxy.client.ip",
"ignore_missing": true,
"field": "source.address",
"ignore_failure": true,
"patterns": [
"^(%{IP:source.ip}|%{HOSTNAME:source.domain})$"
"^%{IP:source.ip}$"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion filebeat/module/haproxy/log/test/default.log-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"event.dataset": "haproxy.log",
"event.module": "haproxy",
"fileset.name": "log",
"haproxy.client.ip": "1.2.3.4",
"haproxy.frontend_name": "main",
"haproxy.mode": "HTTP",
"haproxy.source": "1.2.3.4",
Expand All @@ -15,6 +14,7 @@
"process.name": "haproxy",
"process.pid": 24551,
"service.type": "haproxy",
"source.address": "1.2.3.4",
"source.geo.continent_name": "North America",
"source.geo.country_iso_code": "US",
"source.geo.location.lat": 37.751,
Expand Down
Loading

0 comments on commit 4a837b7

Please sign in to comment.