Skip to content

Commit

Permalink
Merge pull request #287 from Security-Onion-Solutions/jertel/exp
Browse files Browse the repository at this point in the history
use unique log keys
  • Loading branch information
jertel authored Sep 30, 2023
2 parents 0b8172e + 0171adc commit b8c0702
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions server/modules/elastic/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ func convertFromElasticResults(store *ElasticEventstore, esJson string, results
reasonDetails = reason["reason"].(string)
}
log.WithFields(log.Fields{
"type": reasonType,
"reason": reasonDetails,
"reasonType": reasonType,
"reason": reasonDetails,
}).Warn("Shard failure")
err = errors.New("ERROR_QUERY_FAILED_ELASTICSEARCH")
}
Expand Down
34 changes: 17 additions & 17 deletions web/websockethandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ func (webSocketHandler *WebSocketHandler) Handle(w http.ResponseWriter, r *http.
user, ok = ctx.Value(ContextKeyRequestor).(*model.User)
if !ok {
log.WithFields(log.Fields{
"remoteAddr": r.RemoteAddr,
"sourceIp": ip,
"path": r.URL.Path,
"messageRemoteAddr": r.RemoteAddr,
"messageSourceIp": ip,
"messagePath": r.URL.Path,
}).Warn("User does not exist in context")
Respond(w, r, http.StatusBadRequest, errors.New("User does not exist in context; unable to complete websocket"))

Expand All @@ -63,19 +63,19 @@ func (webSocketHandler *WebSocketHandler) Handle(w http.ResponseWriter, r *http.
connection, err := upgrader.Upgrade(w, r, nil)
if err != nil {
log.WithError(err).WithFields(log.Fields{
"remoteAddr": r.RemoteAddr,
"sourceIp": ip,
"path": r.URL.Path,
"messageRemoteAddr": r.RemoteAddr,
"messageSourceIp": ip,
"messagePath": r.URL.Path,
}).Warn("Failed to upgrade websocket")
Respond(w, r, http.StatusBadRequest, err)

return
}

log.WithFields(log.Fields{
"remoteAddr": r.RemoteAddr,
"sourceIp": ip,
"path": r.URL.Path,
"messageRemoteAddr": r.RemoteAddr,
"messageSourceIp": ip,
"messagePath": r.URL.Path,
}).Info("WebSocket connected")

conn := webSocketHandler.Host.AddConnection(user, connection, ip)
Expand All @@ -87,21 +87,21 @@ func (webSocketHandler *WebSocketHandler) Handle(w http.ResponseWriter, r *http.
break
}
log.WithFields(log.Fields{
"remoteAddr": r.RemoteAddr,
"sourceIp": ip,
"path": r.URL.Path,
"msg": string(messageBytes),
"type": messageType,
"messageRemoteAddr": r.RemoteAddr,
"messageSourceIp": ip,
"messagePath": r.URL.Path,
"messageContent": string(messageBytes),
"messageType": messageType,
}).Info("WebSocket message received")

msg := &WebSocketMessage{}
json.LoadJson(messageBytes, msg)
webSocketHandler.handleMessage(msg, conn)
}
log.WithFields(log.Fields{
"remoteAddr": r.RemoteAddr,
"sourceIp": ip,
"path": r.URL.Path,
"messageRemoteAddr": r.RemoteAddr,
"messageSourceIp": ip,
"messagePath": r.URL.Path,
}).Info("WebSocket disconnected")
webSocketHandler.Host.RemoveConnection(connection)

Expand Down

0 comments on commit b8c0702

Please sign in to comment.