Skip to content

Commit

Permalink
[Auditbeat] Socket: Remove ecsDirectionString() (#10616)
Browse files Browse the repository at this point in the history
Removes `ecsDirectionString()` from the Auditbeat `socket` dataset following #10339.
  • Loading branch information
Christoph Wurm authored Feb 7, 2019
1 parent 1bab8f8 commit 2cc1c32
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions x-pack/auditbeat/module/system/socket/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s Socket) toMapStr() common.MapStr {
mapstr := common.MapStr{
"network": common.MapStr{
"type": s.Family.String(),
"direction": ecsDirectionString(s.Direction),
"direction": s.Direction.String(),
},
"user": common.MapStr{
"id": s.UID,
Expand Down Expand Up @@ -190,21 +190,6 @@ func (s Socket) entityID(hostID string) string {
return h.Sum()
}

// ecsDirectionString is a custom alternative to the existing String()
// to be compatible with recommended ECS values for network.direction.
func ecsDirectionString(direction sock.Direction) string {
switch direction {
case sock.Inbound:
return "inbound"
case sock.Outbound:
return "outbound"
case sock.Listening:
return "listening"
default:
return "unknown"
}
}

// New constructs a new MetricSet.
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
cfgwarn.Experimental("The %v/%v dataset is experimental", moduleName, metricsetName)
Expand Down Expand Up @@ -357,7 +342,7 @@ func socketMessage(socket *Socket, action eventAction) string {
}

return fmt.Sprintf("%v socket (%v) %v by process %v (PID: %d) and user %v (UID: %d)",
strings.Title(ecsDirectionString(socket.Direction)), endpointString, actionString,
strings.Title(socket.Direction.String()), endpointString, actionString,
socket.ProcessName, socket.ProcessPID, socket.Username, socket.UID)
}

Expand Down

0 comments on commit 2cc1c32

Please sign in to comment.