fix: ingest oss traffic logs without file extensions
This commit is contained in:
@@ -1790,9 +1790,15 @@ async function runDownloadTrafficLogReconcile(trigger = 'interval') {
|
|||||||
const processed = DownloadTrafficIngestDB.isProcessed(ingestConfig.bucket, key, etag);
|
const processed = DownloadTrafficIngestDB.isProcessed(ingestConfig.bucket, key, etag);
|
||||||
if (processed) continue;
|
if (processed) continue;
|
||||||
|
|
||||||
// 仅处理常见日志文件后缀
|
// 兼容无后缀日志(阿里云 OSS 默认日志文件通常没有 .log 后缀)
|
||||||
|
if (key.endsWith('/')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const lowerKey = key.toLowerCase();
|
const lowerKey = key.toLowerCase();
|
||||||
if (!lowerKey.endsWith('.log') && !lowerKey.endsWith('.txt') && !lowerKey.endsWith('.gz')) {
|
const hasKnownLogExt = lowerKey.endsWith('.log') || lowerKey.endsWith('.txt') || lowerKey.endsWith('.gz');
|
||||||
|
const hasLogLikeToken = lowerKey.includes('traffic') || lowerKey.includes('access') || lowerKey.includes('log');
|
||||||
|
// 当前缀未配置时,避免误扫整桶普通业务对象
|
||||||
|
if (!ingestConfig.prefix && !hasKnownLogExt && !hasLogLikeToken) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user