Skip to content

Commit

Permalink
satellite/console: Fix audit logging
Browse files Browse the repository at this point in the history
There was a typo in the existing audit log implementation which
prevented logs from displaying optional extra arguments that can be
passed in.

Change-Id: I8aa59f7ec653998a6e75ee20d5b0e65d9773a135
  • Loading branch information
mobyvb committed Dec 13, 2023
1 parent 955c933 commit 92b485a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions satellite/console/service.go
Expand Up @@ -276,7 +276,7 @@ func getRequestingIP(ctx context.Context) (source, forwardedFor string) {
func (s *Service) auditLog(ctx context.Context, operation string, userID *uuid.UUID, email string, extra ...zap.Field) {
sourceIP, forwardedForIP := getRequestingIP(ctx)
fields := append(
make([]zap.Field, 0, len(extra)+5),
make([]zap.Field, 0, len(extra)+6),
zap.String("operation", operation),
zap.String("source-ip", sourceIP),
zap.String("forwarded-for-ip", forwardedForIP),
Expand All @@ -291,7 +291,7 @@ func (s *Service) auditLog(ctx context.Context, operation string, userID *uuid.U
fields = append(fields, zap.String("requestID", requestID))
}

fields = append(fields, fields...)
fields = append(fields, extra...)
s.auditLogger.Info("console activity", fields...)
}

Expand Down Expand Up @@ -3932,7 +3932,7 @@ func (s *Service) InviteNewProjectMember(ctx context.Context, projectID uuid.UUI
user, err := s.getUserAndAuditLog(ctx,
"invite project member",
zap.String("projectID", projectID.String()),
zap.String("email", email),
zap.String("invitedEmail", email),
)
if err != nil {
return nil, Error.Wrap(err)
Expand Down

0 comments on commit 92b485a

Please sign in to comment.