logger: Avoid slow calls in http logger Send() function (#17747)

Send() is synchronous and can affect the latency of S3 requests when the
logger buffer is full.

Avoid checking if the HTTP target is online or not and increase the
workers anyway since the buffer is already full.

Also, avoid logs flooding when the audit target is down.
This commit is contained in:
Anis Eleuch
2023-07-29 20:49:18 +01:00
committed by GitHub
parent ad2a70ba06
commit 9c0e8cd15b
2 changed files with 11 additions and 17 deletions
+1 -2
View File
@@ -28,7 +28,6 @@ import (
"github.com/minio/minio/internal/mcontext"
"github.com/minio/pkg/logger/message/audit"
"github.com/minio/madmin-go/v3"
xhttp "github.com/minio/minio/internal/http"
)
@@ -145,7 +144,7 @@ func AuditLog(ctx context.Context, w http.ResponseWriter, r *http.Request, reqCl
// Send audit logs only to http targets.
for _, t := range auditTgts {
if err := t.Send(ctx, entry); err != nil {
LogAlwaysIf(context.Background(), fmt.Errorf("event(%v) was not sent to Audit target (%v): %v", entry, t, err), madmin.LogKindAll)
LogOnceIf(ctx, fmt.Errorf("Unable to send an audit event to the target `%v`: %v", t, err), "send-audit-event-failure")
}
}
}