Author Login Chief Editor Login Reviewer Login Editor Login Remote Office

Computer Engineering

   

Adaptive Parsing Method for Massive Multidimensional Heterogeneous Logs

  

  • Published:2026-11-27

海量多维异构日志自适应解析方法

Abstract: To address template fragmentation and incorrect matching caused by structural variations, frequent changes in dynamic fields, and field insertion, deletion, or positional shifts in large-scale multi-source logs, this paper proposes SNDrain, a log parsing method that combines subsequence recognition with N-gram similarity. SNDrain normalizes dynamic fields and irrelevant symbols, and uses a fixed-depth parse tree to narrow the candidate template set based on log length and prefix information. When the conventional tree search fails to find a valid match, a subsequence consistency check is applied to further group structurally similar logs of different lengths and update templates according to token differences. At the leaf-node matching stage, log messages and candidate templates are represented as N-gram fragment sets composed of consecutive tokens. Jaccard similarity is then combined with token-by-token matching to reduce the effect of local positional shifts on template selection. Experiments on 12 LogHub datasets, as well as large-scale HDFS and BGL datasets, show that SNDrain achieves an average accuracy of 0.96, a recall close to 1, and an F1-score of 0.997. On 5 million HDFS logs and 1 million BGL logs, the parsing accuracy reaches 1 and 0.931, respectively, with 40 and 160 final log templates generated. These results show that SNDrain can reduce template fragmentation caused by structural changes and improve parsing accuracy and adaptability across different log scales.

摘要: 针对海量多源日志中结构差异大、动态字段频繁变化,以及字段插入、缺失和位置偏移易引起模板分裂与错误匹配的问题,提出基于子序列识别与N-Gram相似度融合的日志解析方法SNDrain。该方法对动态字段和无效符号进行规范化处理,并利用固定深度解析树依据日志长度和前缀信息缩小候选模板范围。当常规树搜索未获得有效匹配时,引入子序列一致性判定,对结构相近但长度不同的日志进行补充归并,并根据词元差异更新模板。在叶节点模板匹配阶段,将日志与候选模板表示为连续token构成的N-Gram片段集合,计算Jaccard相似度,并与逐词匹配结果融合,以降低局部位置偏移对模板判定的影响。基于12个LogHub数据集及HDFS、BGL大规模数据的实验显示,SNDrain的平均准确率为0.96,召回率接近1,F1-Score为0.997。在500万条HDFS和100万条BGL日志上,准确率分别为1和0.931,最终生成的日志模板数量分别为40和160。SNDrain能够减少字段变化引起的模板分裂,并提高海量异构日志解析的准确率及对不同数据规模的适应能力。