fix: ingest oss traffic logs without file extensions

This commit is contained in:
2026-02-18 10:24:00 +08:00
parent 7ee727bd3a
commit 5eab1de03e

View File

@@ -1790,9 +1790,15 @@ async function runDownloadTrafficLogReconcile(trigger = 'interval') {
const processed = DownloadTrafficIngestDB.isProcessed(ingestConfig.bucket, key, etag);
if (processed) continue;
// 仅处理常见日志文件后缀
// 兼容无后缀日志(阿里云 OSS 默认日志文件通常没有 .log 后缀
if (key.endsWith('/')) {
continue;
}
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;
}