mirror of
https://github.com/minio/minio.git
synced 2025-01-12 23:43:22 -05:00
Add audit for folder excess (#19109)
Also replace ilm:expiry with scanner to avoid user confusion
This commit is contained in:
parent
c32f699105
commit
8c53a4405a
@ -529,17 +529,27 @@ func (f *folderScanner) scanFolder(ctx context.Context, folder cachedFolder, int
|
|||||||
len(existingFolders)+len(newFolders) >= dataScannerCompactAtFolders ||
|
len(existingFolders)+len(newFolders) >= dataScannerCompactAtFolders ||
|
||||||
len(existingFolders)+len(newFolders) >= dataScannerForceCompactAtFolders
|
len(existingFolders)+len(newFolders) >= dataScannerForceCompactAtFolders
|
||||||
|
|
||||||
if len(existingFolders)+len(newFolders) > int(scannerExcessFolders.Load()) {
|
if totalFolders := len(existingFolders) + len(newFolders); totalFolders > int(scannerExcessFolders.Load()) {
|
||||||
|
prefixName := strings.TrimSuffix(folder.name, "/") + "/"
|
||||||
sendEvent(eventArgs{
|
sendEvent(eventArgs{
|
||||||
EventName: event.PrefixManyFolders,
|
EventName: event.PrefixManyFolders,
|
||||||
BucketName: f.root,
|
BucketName: f.root,
|
||||||
Object: ObjectInfo{
|
Object: ObjectInfo{
|
||||||
Name: strings.TrimSuffix(folder.name, "/") + "/",
|
Name: prefixName,
|
||||||
Size: int64(len(existingFolders) + len(newFolders)),
|
Size: int64(totalFolders),
|
||||||
},
|
},
|
||||||
UserAgent: "scanner",
|
UserAgent: "Scanner",
|
||||||
Host: globalMinioHost,
|
Host: globalMinioHost,
|
||||||
})
|
})
|
||||||
|
auditLogInternal(context.Background(), AuditLogOptions{
|
||||||
|
Event: "scanner:manyprefixes",
|
||||||
|
APIName: "Scanner",
|
||||||
|
Bucket: f.root,
|
||||||
|
Object: prefixName,
|
||||||
|
Tags: map[string]interface{}{
|
||||||
|
"x-minio-prefixes-total": strconv.Itoa(totalFolders),
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if !into.Compacted && shouldCompact {
|
if !into.Compacted && shouldCompact {
|
||||||
into.Compacted = true
|
into.Compacted = true
|
||||||
@ -1107,18 +1117,18 @@ func (i *scannerItem) applyVersionActions(ctx context.Context, o ObjectLayer, fi
|
|||||||
Object: ObjectInfo{
|
Object: ObjectInfo{
|
||||||
Name: i.objectPath(),
|
Name: i.objectPath(),
|
||||||
},
|
},
|
||||||
UserAgent: "Internal: [Scanner]",
|
UserAgent: "Scanner",
|
||||||
Host: globalLocalNodeName,
|
Host: globalLocalNodeName,
|
||||||
RespElements: map[string]string{"x-minio-versions": strconv.Itoa(len(fivs))},
|
RespElements: map[string]string{"x-minio-versions": strconv.Itoa(len(objInfos))},
|
||||||
})
|
})
|
||||||
|
|
||||||
auditLogInternal(context.Background(), AuditLogOptions{
|
auditLogInternal(context.Background(), AuditLogOptions{
|
||||||
Event: "scanner:manyversions",
|
Event: "scanner:manyversions",
|
||||||
APIName: ILMExpiry,
|
APIName: "Scanner",
|
||||||
Bucket: i.bucket,
|
Bucket: i.bucket,
|
||||||
Object: i.objectPath(),
|
Object: i.objectPath(),
|
||||||
Tags: map[string]interface{}{
|
Tags: map[string]interface{}{
|
||||||
"x-minio-versions": strconv.Itoa(len(fivs)),
|
"x-minio-versions": strconv.Itoa(len(objInfos)),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user