diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go index 54293e95a..953eb8a9a 100644 --- a/weed/s3api/auth_credentials.go +++ b/weed/s3api/auth_credentials.go @@ -177,41 +177,41 @@ func NewIdentityAccessManagementWithStore(option *S3ApiServerOption, explicitSto accessKeyId := os.Getenv("AWS_ACCESS_KEY_ID") secretAccessKey := os.Getenv("AWS_SECRET_ACCESS_KEY") - if accessKeyId != "" && secretAccessKey != "" { - glog.V(0).Infof("No S3 configuration found, using AWS environment variables as fallback") + if accessKeyId != "" && secretAccessKey != "" { + glog.V(1).Infof("No S3 configuration found, using AWS environment variables as fallback") - // Create environment variable identity name - identityNameSuffix := accessKeyId - if len(accessKeyId) > 8 { - identityNameSuffix = accessKeyId[:8] - } + // Create environment variable identity name + identityNameSuffix := accessKeyId + if len(accessKeyId) > 8 { + identityNameSuffix = accessKeyId[:8] + } - // Create admin identity with environment variable credentials - envIdentity := &Identity{ - Name: "admin-" + identityNameSuffix, - Account: &AccountAdmin, - Credentials: []*Credential{ - { - AccessKey: accessKeyId, - SecretKey: secretAccessKey, - }, + // Create admin identity with environment variable credentials + envIdentity := &Identity{ + Name: "admin-" + identityNameSuffix, + Account: &AccountAdmin, + Credentials: []*Credential{ + { + AccessKey: accessKeyId, + SecretKey: secretAccessKey, }, - Actions: []Action{ - s3_constants.ACTION_ADMIN, - }, - } - - // Set as the only configuration - iam.m.Lock() - if len(iam.identities) == 0 { - iam.identities = []*Identity{envIdentity} - iam.accessKeyIdent = map[string]*Identity{accessKeyId: envIdentity} - iam.isAuthEnabled = true - } - iam.m.Unlock() + }, + Actions: []Action{ + s3_constants.ACTION_ADMIN, + }, + } - glog.V(0).Infof("Added admin identity from AWS environment variables: %s", envIdentity.Name) + // Set as the only configuration + iam.m.Lock() + if len(iam.identities) == 0 { + iam.identities = []*Identity{envIdentity} + iam.accessKeyIdent = map[string]*Identity{accessKeyId: envIdentity} + iam.isAuthEnabled = true } + iam.m.Unlock() + + glog.V(1).Infof("Added admin identity from AWS environment variables: %s", envIdentity.Name) + } } return iam @@ -460,13 +460,13 @@ func (iam *IdentityAccessManagement) authRequest(r *http.Request, action Action) case authTypeJWT: glog.V(3).Infof("jwt auth type detected, iamIntegration != nil? %t", iam.iamIntegration != nil) r.Header.Set(s3_constants.AmzAuthType, "Jwt") - if iam.iamIntegration != nil { - identity, s3Err = iam.authenticateJWTWithIAM(r) - authType = "Jwt" - } else { - glog.V(0).Infof("IAM integration is nil, returning ErrNotImplemented") - return identity, s3err.ErrNotImplemented - } + if iam.iamIntegration != nil { + identity, s3Err = iam.authenticateJWTWithIAM(r) + authType = "Jwt" + } else { + glog.V(2).Infof("IAM integration is nil, returning ErrNotImplemented") + return identity, s3err.ErrNotImplemented + } case authTypeAnonymous: authType = "Anonymous" if identity, found = iam.lookupAnonymous(); !found { diff --git a/weed/s3api/auth_credentials_subscribe.go b/weed/s3api/auth_credentials_subscribe.go index 00df259a2..e03b1c05b 100644 --- a/weed/s3api/auth_credentials_subscribe.go +++ b/weed/s3api/auth_credentials_subscribe.go @@ -52,7 +52,7 @@ func (s3a *S3ApiServer) subscribeMetaEvents(clientName string, lastTsNs int64, p metadataFollowOption.ClientEpoch++ return pb.WithFilerClientFollowMetadata(s3a, metadataFollowOption, processEventFn) }, func(err error) bool { - glog.V(0).Infof("iam follow metadata changes: %v", err) + glog.V(1).Infof("iam follow metadata changes: %v", err) return true }) } @@ -63,7 +63,7 @@ func (s3a *S3ApiServer) onIamConfigUpdate(dir, filename string, content []byte) if err := s3a.iam.LoadS3ApiConfigurationFromBytes(content); err != nil { return err } - glog.V(0).Infof("updated %s/%s", dir, filename) + glog.V(1).Infof("updated %s/%s", dir, filename) } return nil } @@ -74,7 +74,7 @@ func (s3a *S3ApiServer) onCircuitBreakerConfigUpdate(dir, filename string, conte if err := s3a.cb.LoadS3ApiConfigurationFromBytes(content); err != nil { return err } - glog.V(0).Infof("updated %s/%s", dir, filename) + glog.V(1).Infof("updated %s/%s", dir, filename) } return nil } @@ -85,14 +85,14 @@ func (s3a *S3ApiServer) onBucketMetadataChange(dir string, oldEntry *filer_pb.En if newEntry != nil { // Update bucket registry (existing functionality) s3a.bucketRegistry.LoadBucketMetadata(newEntry) - glog.V(0).Infof("updated bucketMetadata %s/%s", dir, newEntry.Name) + glog.V(1).Infof("updated bucketMetadata %s/%s", dir, newEntry.Name) // Update bucket configuration cache with new entry s3a.updateBucketConfigCacheFromEntry(newEntry) } else if oldEntry != nil { // Remove from bucket registry (existing functionality) s3a.bucketRegistry.RemoveBucketMetadata(oldEntry) - glog.V(0).Infof("remove bucketMetadata %s/%s", dir, oldEntry.Name) + glog.V(1).Infof("remove bucketMetadata %s/%s", dir, oldEntry.Name) // Remove from bucket configuration cache s3a.invalidateBucketConfigCache(oldEntry.Name) diff --git a/weed/s3api/filer_util.go b/weed/s3api/filer_util.go index ef7396996..168cdc3ef 100644 --- a/weed/s3api/filer_util.go +++ b/weed/s3api/filer_util.go @@ -68,7 +68,7 @@ func doDeleteEntry(client filer_pb.SeaweedFilerClient, parentDirectoryPath strin glog.V(1).Infof("delete entry %v/%v: %v", parentDirectoryPath, entryName, request) if resp, err := client.DeleteEntry(context.Background(), request); err != nil { - glog.V(0).Infof("delete entry %v: %v", request, err) + glog.V(1).Infof("delete entry %v: %v", request, err) return fmt.Errorf("delete entry %s/%s: %v", parentDirectoryPath, entryName, err) } else { if resp.Error != "" { diff --git a/weed/s3api/s3_iam_middleware.go b/weed/s3api/s3_iam_middleware.go index 4cb14490a..22e7b2233 100644 --- a/weed/s3api/s3_iam_middleware.go +++ b/weed/s3api/s3_iam_middleware.go @@ -452,7 +452,7 @@ func minInt(a, b int) int { func (s3a *S3ApiServer) SetIAMIntegration(iamManager *integration.IAMManager) { if s3a.iam != nil { s3a.iam.iamIntegration = NewS3IAMIntegration(iamManager, "localhost:8888") - glog.V(0).Infof("IAM integration successfully set on S3ApiServer") + glog.V(1).Infof("IAM integration successfully set on S3ApiServer") } else { glog.Errorf("Cannot set IAM integration: s3a.iam is nil") } diff --git a/weed/s3api/s3_multipart_iam.go b/weed/s3api/s3_multipart_iam.go index a9d6c7ccf..9b56efc07 100644 --- a/weed/s3api/s3_multipart_iam.go +++ b/weed/s3api/s3_multipart_iam.go @@ -83,7 +83,7 @@ func (iam *IdentityAccessManagement) ValidateMultipartOperationWithIAM(r *http.R // This header is set during initial authentication and contains the correct assumed role ARN principalArn := r.Header.Get("X-SeaweedFS-Principal") if principalArn == "" { - glog.V(0).Info("IAM authorization for multipart operation failed: missing principal ARN in request header") + glog.V(2).Info("IAM authorization for multipart operation failed: missing principal ARN in request header") return s3err.ErrAccessDenied } diff --git a/weed/s3api/s3api_object_versioning.go b/weed/s3api/s3api_object_versioning.go index 17a00ee01..1c1dbee03 100644 --- a/weed/s3api/s3api_object_versioning.go +++ b/weed/s3api/s3api_object_versioning.go @@ -328,7 +328,7 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string seenVersionIds[versionKey] = true if version.IsDeleteMarker { - glog.V(0).Infof("Adding delete marker from .versions: objectKey=%s, versionId=%s, isLatest=%v, versionKey=%s", + glog.V(4).Infof("Adding delete marker from .versions: objectKey=%s, versionId=%s, isLatest=%v, versionKey=%s", normalizedObjectKey, version.VersionId, version.IsLatest, versionKey) deleteMarker := &DeleteMarkerEntry{ Key: normalizedObjectKey, // Use normalized key for consistency @@ -339,7 +339,7 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string } *allVersions = append(*allVersions, deleteMarker) } else { - glog.V(0).Infof("Adding version from .versions: objectKey=%s, versionId=%s, isLatest=%v, versionKey=%s", + glog.V(4).Infof("Adding version from .versions: objectKey=%s, versionId=%s, isLatest=%v, versionKey=%s", normalizedObjectKey, version.VersionId, version.IsLatest, versionKey) versionEntry := &VersionEntry{ Key: normalizedObjectKey, // Use normalized key for consistency @@ -401,12 +401,12 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string // Skip if this object already has a .versions directory (already processed) // Check both normalized and original keys for backward compatibility if processedObjects[objectKey] || processedObjects[normalizedObjectKey] { - glog.V(0).Infof("Skipping already processed object: objectKey=%s, normalizedObjectKey=%s, processedObjects[objectKey]=%v, processedObjects[normalizedObjectKey]=%v", + glog.V(4).Infof("Skipping already processed object: objectKey=%s, normalizedObjectKey=%s, processedObjects[objectKey]=%v, processedObjects[normalizedObjectKey]=%v", objectKey, normalizedObjectKey, processedObjects[objectKey], processedObjects[normalizedObjectKey]) continue } - glog.V(0).Infof("Processing regular file: objectKey=%s, normalizedObjectKey=%s, NOT in processedObjects", objectKey, normalizedObjectKey) + glog.V(4).Infof("Processing regular file: objectKey=%s, normalizedObjectKey=%s, NOT in processedObjects", objectKey, normalizedObjectKey) // This is a pre-versioning or suspended-versioning object // Check if this file has version metadata (ExtVersionIdKey) @@ -414,7 +414,7 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string if entry.Extended != nil { if versionIdBytes, ok := entry.Extended[s3_constants.ExtVersionIdKey]; ok { hasVersionMeta = true - glog.V(0).Infof("Regular file %s has version metadata: %s", normalizedObjectKey, string(versionIdBytes)) + glog.V(4).Infof("Regular file %s has version metadata: %s", normalizedObjectKey, string(versionIdBytes)) } } @@ -423,12 +423,12 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string _, versionsErr := s3a.getEntry(currentPath, versionsObjectPath) if versionsErr == nil { // .versions directory exists - glog.V(0).Infof("Found .versions directory for regular file %s, hasVersionMeta=%v", normalizedObjectKey, hasVersionMeta) + glog.V(4).Infof("Found .versions directory for regular file %s, hasVersionMeta=%v", normalizedObjectKey, hasVersionMeta) // If this file has version metadata, it's a suspended versioning null version // Include it and it will be the latest if hasVersionMeta { - glog.V(0).Infof("Including suspended versioning file %s (has version metadata)", normalizedObjectKey) + glog.V(4).Infof("Including suspended versioning file %s (has version metadata)", normalizedObjectKey) // Continue to add it below } else { // No version metadata - this is a pre-versioning file @@ -443,16 +443,16 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string } } if hasNullVersion { - glog.V(0).Infof("Skipping pre-versioning file %s, null version exists in .versions", normalizedObjectKey) + glog.V(4).Infof("Skipping pre-versioning file %s, null version exists in .versions", normalizedObjectKey) processedObjects[objectKey] = true processedObjects[normalizedObjectKey] = true continue } } - glog.V(0).Infof("Including pre-versioning file %s (no null version in .versions)", normalizedObjectKey) + glog.V(4).Infof("Including pre-versioning file %s (no null version in .versions)", normalizedObjectKey) } } else { - glog.V(0).Infof("No .versions directory for regular file %s, hasVersionMeta=%v", normalizedObjectKey, hasVersionMeta) + glog.V(4).Infof("No .versions directory for regular file %s, hasVersionMeta=%v", normalizedObjectKey, hasVersionMeta) } // Add this file as a null version with IsLatest=true @@ -469,7 +469,7 @@ func (s3a *S3ApiServer) findVersionsRecursively(currentPath, relativePath string etag := s3a.calculateETagFromChunks(entry.Chunks) - glog.V(0).Infof("Adding null version from regular file: objectKey=%s, normalizedObjectKey=%s, versionKey=%s, isLatest=%v, hasVersionMeta=%v", + glog.V(4).Infof("Adding null version from regular file: objectKey=%s, normalizedObjectKey=%s, versionKey=%s, isLatest=%v, hasVersionMeta=%v", objectKey, normalizedObjectKey, versionKey, isLatest, hasVersionMeta) versionEntry := &VersionEntry{ diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go index 5314ec86b..976ed2da9 100644 --- a/weed/s3api/s3api_server.go +++ b/weed/s3api/s3api_server.go @@ -108,7 +108,7 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl // Initialize advanced IAM system if config is provided if option.IamConfig != "" { - glog.V(0).Infof("Loading advanced IAM configuration from: %s", option.IamConfig) + glog.V(1).Infof("Loading advanced IAM configuration from: %s", option.IamConfig) iamManager, err := loadIAMManagerFromConfig(option.IamConfig, func() string { return string(option.Filer) @@ -125,7 +125,7 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl // Set the integration in the traditional IAM for compatibility iam.SetIAMIntegration(s3iam) - glog.V(0).Infof("Advanced IAM system initialized successfully") + glog.V(1).Infof("Advanced IAM system initialized successfully") } } @@ -134,7 +134,7 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl if err := s3ApiServer.iam.loadS3ApiConfigurationFromFile(option.Config); err != nil { glog.Errorf("fail to load config file %s: %v", option.Config, err) } else { - glog.V(0).Infof("Loaded %d identities from config file %s", len(s3ApiServer.iam.identities), option.Config) + glog.V(1).Infof("Loaded %d identities from config file %s", len(s3ApiServer.iam.identities), option.Config) } }) } @@ -502,7 +502,7 @@ func loadIAMManagerFromConfig(configPath string, filerAddressProvider func() str if configRoot.Policy == nil { // Provide a secure default if not specified in the config file // Default to Deny with in-memory store so that JSON-defined policies work without filer - glog.V(0).Infof("No policy engine config provided; using defaults (DefaultEffect=%s, StoreType=%s)", sts.EffectDeny, sts.StoreTypeMemory) + glog.V(1).Infof("No policy engine config provided; using defaults (DefaultEffect=%s, StoreType=%s)", sts.EffectDeny, sts.StoreTypeMemory) configRoot.Policy = &policy.PolicyEngineConfig{ DefaultEffect: sts.EffectDeny, StoreType: sts.StoreTypeMemory, @@ -560,7 +560,7 @@ func loadIAMManagerFromConfig(configPath string, filerAddressProvider func() str } } - glog.V(0).Infof("Loaded %d providers, %d policies and %d roles from config", len(configRoot.Providers), len(configRoot.Policies), len(configRoot.Roles)) + glog.V(1).Infof("Loaded %d providers, %d policies and %d roles from config", len(configRoot.Providers), len(configRoot.Policies), len(configRoot.Roles)) return iamManager, nil } diff --git a/weed/s3api/s3err/error_handler.go b/weed/s3api/s3err/error_handler.go index 24dcfad7f..4f96b4ffb 100644 --- a/weed/s3api/s3err/error_handler.go +++ b/weed/s3api/s3err/error_handler.go @@ -121,7 +121,7 @@ func WriteResponse(w http.ResponseWriter, r *http.Request, statusCode int, respo glog.V(4).Infof("status %d %s: %s", statusCode, mType, string(response)) _, err := w.Write(response) if err != nil { - glog.V(0).Infof("write err: %v", err) + glog.V(1).Infof("write err: %v", err) } w.(http.Flusher).Flush() } @@ -129,6 +129,6 @@ func WriteResponse(w http.ResponseWriter, r *http.Request, statusCode int, respo // If none of the http routes match respond with MethodNotAllowed func NotFoundHandler(w http.ResponseWriter, r *http.Request) { - glog.V(0).Infof("unsupported %s %s", r.Method, r.RequestURI) + glog.V(2).Infof("unsupported %s %s", r.Method, r.RequestURI) WriteErrorResponse(w, r, ErrMethodNotAllowed) }