Skip to content

Commit

Permalink
Add client address to events from http server module (elastic#18336)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed May 8, 2020
1 parent 46a3d35 commit da1ba72
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Collect new `bulk` indexing metrics from Elasticsearch when `xpack.enabled:true` is set. {issue} {pull}17992[17992]
- Remove requirement to connect as sysdba in Oracle module {issue}15846[15846] {pull}18182[18182]
- Update MSSQL module to fix some SSPI authentication and add brackets to USE statements {pull}17862[17862]]
- Add client address to events from http server module {pull}18336[18336]

*Packetbeat*

Expand Down
3 changes: 2 additions & 1 deletion metricbeat/helper/server/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ func (h *HttpServer) handleFunc(writer http.ResponseWriter, req *http.Request) {
switch req.Method {
case "POST":
meta := server.Meta{
"path": req.URL.String(),
"path": req.URL.String(),
"address": req.RemoteAddr,
}

contentType := req.Header.Get("Content-Type")
Expand Down
5 changes: 4 additions & 1 deletion metricbeat/module/http/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ func (m *MetricSet) Run(reporter mb.PushReporterV2) {
if err != nil {
reporter.Error(err)
} else {
event := mb.Event{}
meta := msg.GetMeta()
event := mb.Event{
Host: meta["address"].(string),
}
ns, ok := fields[mb.NamespaceKey].(string)
if ok {
ns = fmt.Sprintf("http.%s", ns)
Expand Down

0 comments on commit da1ba72

Please sign in to comment.