Skip to content

Commit

Permalink
Sanitize event.host in Metricbeat (elastic#21022)
Browse files Browse the repository at this point in the history
* Sanitize event.host

* Update CHANGELOG

* Fix: enable host parser
  • Loading branch information
mtojek authored Sep 9, 2020
1 parent 7326d5d commit 3ecf7e6
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Request prometheus endpoints to be gzipped by default {pull}20766[20766]
- Release all kubernetes `state` metricsets as GA {pull}20901[20901]
- Add billing metricset into googlecloud module. {pull}20812[20812] {issue}20738[20738]
- Sanitize `event.host`. {pull}21022[21022]

*Packetbeat*

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/mb/module/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (r reporterV2) Event(event mb.Event) bool {
}

if event.Host == "" {
event.Host = r.msw.Host()
event.Host = r.msw.HostData().SanitizedURI
}

if event.Error == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@
"module": "oracle"
},
"metricset": {
"name": "performance"
"name": "performance",
"period": 10000
},
"oracle": {
"performance": {
"buffer_pool": "DEFAULT",
"cache": {
"buffer": {
"hit": {
"pct": 0.9636984728969045
"pct": 0.970465382180896
}
},
"get": {
"consistent": 477505,
"db_blocks": 66990
"consistent": 604979,
"db_blocks": 88580
},
"physical_reads": 19766
"physical_reads": 20484
}
}
},
"service": {
"address": "oracle://sys:Oradoc_db1@localhost/ORCLPDB1.localdomain?connectionClass=\u0026poolIncrement=0\u0026poolMaxSessions=0\u0026poolMinSessions=0\u0026sysdba=1\u0026sysoper=0\u0026sysasm=0\u0026standaloneConnection=0\u0026enableEvents=0\u0026heterogeneousPool=0\u0026prelim=0",
"address": "localhost:32769",
"type": "oracle"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
"module": "oracle"
},
"metricset": {
"name": "performance"
"name": "performance",
"period": 10000
},
"oracle": {
"performance": {
"cursors": {
"avg": 0.6829268292682927,
"avg": 0.627906976744186,
"max": 17,
"total": 28
"total": 27
},
"machine": "2ed9ac3a4c3d",
"machine": "f29609d6403a",
"username": "Unknown"
}
},
"service": {
"address": "oracle://sys:Oradoc_db1@localhost/ORCLPDB1.localdomain?connectionClass=\u0026poolIncrement=0\u0026poolMaxSessions=0\u0026poolMinSessions=0\u0026sysdba=1\u0026sysoper=0\u0026sysasm=0\u0026standaloneConnection=0\u0026enableEvents=0\u0026heterogeneousPool=0\u0026prelim=0",
"address": "localhost:32769",
"type": "oracle"
}
}
23 changes: 12 additions & 11 deletions x-pack/metricbeat/module/oracle/performance/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,34 @@
"module": "oracle"
},
"metricset": {
"name": "performance"
"name": "performance",
"period": 10000
},
"oracle": {
"performance": {
"cursors": {
"cache_hit": {
"pct": 0.8311065930874237
"pct": 0.8215208034433286
},
"opened": {
"current": 5,
"total": 6886
"current": 32,
"total": 125460
},
"parse": {
"real": 1524,
"total": 4199
"real": 39150,
"total": 63918
},
"session": {
"cache_hits": 5723
"cache_hits": 103068
}
},
"io_reloads": 0.0015732643391367942,
"lock_requests": 0.5958019475347308,
"pin_requests": 0.8058170730696832
"io_reloads": 0.009607787973500542,
"lock_requests": 0.5939075233457263,
"pin_requests": 0.7450330613301921
}
},
"service": {
"address": "oracle://sys:Oradoc_db1@localhost/ORCLPDB1.localdomain?connectionClass=\u0026poolIncrement=0\u0026poolMaxSessions=0\u0026poolMinSessions=0\u0026sysdba=1\u0026sysoper=0\u0026sysasm=0\u0026standaloneConnection=0\u0026enableEvents=0\u0026heterogeneousPool=0\u0026prelim=0",
"address": "localhost:32769",
"type": "oracle"
}
}
3 changes: 2 additions & 1 deletion x-pack/metricbeat/module/oracle/performance/metricset.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import (
// the MetricSet for each host defined in the module's configuration. After the
// MetricSet has been created then Fetch will begin to be called periodically.
func init() {
mb.Registry.MustAddMetricSet("oracle", "performance", New)
mb.Registry.MustAddMetricSet("oracle", "performance", New,
mb.WithHostParser(oracle.HostParser))
}

// MetricSet holds any configuration or state information. It must implement
Expand Down
17 changes: 9 additions & 8 deletions x-pack/metricbeat/module/oracle/tablespace/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
"module": "oracle"
},
"metricset": {
"name": "tablespace"
"name": "tablespace",
"period": 10000
},
"oracle": {
"tablespace": {
"data_file": {
"id": 18,
"name": "/u02/app/oracle/oradata/ORCLCDB/orclpdb1/sysaux01.dbf",
"id": 3,
"name": "/u02/app/oracle/oradata/ORCL/sysaux01.dbf",
"online_status": "ONLINE",
"size": {
"bytes": 618659840,
"bytes": 744488960,
"free": {
"bytes": 617611264
"bytes": 743440384
},
"max": {
"bytes": 34359721984
Expand All @@ -28,16 +29,16 @@
"name": "SYSAUX",
"space": {
"free": {
"bytes": 34799616
"bytes": 39124992
},
"used": {
"bytes": 618659840
"bytes": 744488960
}
}
}
},
"service": {
"address": "oracle://sys:Oradoc_db1@localhost:1521/ORCLPDB1.localdomain?connectionClass=\u0026poolIncrement=0\u0026poolMaxSessions=0\u0026poolMinSessions=0\u0026sysdba=1\u0026sysoper=0\u0026sysasm=0\u0026standaloneConnection=0\u0026enableEvents=0\u0026heterogeneousPool=0\u0026prelim=0",
"address": "localhost:32769",
"type": "oracle"
}
}
3 changes: 2 additions & 1 deletion x-pack/metricbeat/module/oracle/tablespace/metricset.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import (
// the MetricSet for each host defined in the module's configuration. After the
// MetricSet has been created then Fetch will begin to be called periodically.
func init() {
mb.Registry.MustAddMetricSet("oracle", "tablespace", New)
mb.Registry.MustAddMetricSet("oracle", "tablespace", New,
mb.WithHostParser(oracle.HostParser))
}

// MetricSet holds any configuration or state information. It must implement
Expand Down

0 comments on commit 3ecf7e6

Please sign in to comment.