Adaptive and Efficient Log Parsing as a Cloud Service

Zeyan Li, Jie Song, Tieying Zhang, Tao Yang, Xiongjun Ou, Yingjie Ye, Pengfei Duan, Muchen Lin, Jianjun ChenarXiv 2025 · DOI

TL;DR

This paper introduces ByteBrain-LogParser, a production-grade log parsing framework designed by ByteDance for massive-scale cloud environments. By combining hierarchical clustering with aggressive optimizations like hash encoding and deduplication, it processes an average of 229,000 logs per second—an 840% speedup over the fastest baseline—while maintaining near state-of-the-art accuracy and allowing users to dynamically adjust parsing precision in real time.

What Problem Does This Paper Address?

Modern cloud systems generate an overwhelming volume of unstructured, text-based logs. To make these logs useful for automated downstream tasks like anomaly detection or root cause analysis, they must first be parsed into structured templates (e.g., turning release:lock=2337, flg=0x0 into release:lock=*, flg=*).

However, doing this at cloud scale introduces a severe four-way tension:

  1. Adaptability: Different users or debugging scenarios require different levels of granularity (coarse-grained vs. fine-grained parsing).
  2. Compute Efficiency: Processing millions of logs per second cannot bottleneck log ingestion pipelines.
  3. Storage Efficiency: Storing massive token-to-ID dictionaries for millions of unique log streams adds prohibitive overhead.
  4. Accuracy: The parser must accurately separate static constants from dynamic variables without manual rule tuning.

Existing approaches fall short. Traditional heuristic or frequent pattern mining methods struggle with diverse log formats. Deep learning and Large Language Model (LLM) approaches offer high accuracy but are far too slow and computationally expensive to run on live, high-throughput cloud streams.

Methods

ByteBrain splits its workload into a two-phase architecture: Offline Training and Online Matching.

Figure 3: System design of ByteBrain-LogParser

1. Preprocessing & Hash Encoding

Instead of using traditional ordinal encoding (which maps every unique string token to a numerical ID and requires storing massive dictionaries), ByteBrain uses a deterministic 64-bit hash encoding scheme. This eliminates dictionary storage entirely and allows tokens to be processed completely in parallel. Aggressive deduplication is also applied early to collapse repeated log patterns.

2. Hierarchical Clustering & Saturation Scoring

During offline training, logs are grouped by length/prefix and fed into a custom hierarchical clustering tree.

  • Positional Similarity Distance: Instead of standard Euclidean distance, ByteBrain uses a custom metric that weights log positions based on token frequency and position variability (giving less weight to highly volatile positions likely to contain variables).
  • Saturation Score: A novel metric that quantifies how well a cluster has resolved its positions into constants or variables. The tree splits iteratively until a target saturation threshold is met. Deeper nodes represent highly precise templates, while higher nodes represent coarser ones.

3. Online Matching & Real-Time Querying

For incoming live logs, ByteBrain bypasses tree traversal entirely. It sequentially matches new logs directly against the pre-trained template texts in descending order of their saturation scores.

Crucially, because the model is stored as a tree, users can use a slider in the UI to dynamically adjust parsing precision at query time. The system simply traverses up to the ancestor nodes to serve coarser templates instantly without reprocessing the underlying logs.

Datasets

The authors evaluated ByteBrain using two primary public benchmarks:

  • LogHub: A standard benchmark consisting of 16 diverse, small-scale datasets (2,000 labeled logs each) spanning operating systems, distributed systems, and applications.
  • LogHub-2.0: A recent, large-scale extension of LogHub containing massive datasets—some exceeding 50 million log messages—designed to test the scalability of modern log parsers.

Key Insights and Ideas

  • The Birthday Paradox is a Feature, Not a Bug: The shift from ordinal encoding to 64-bit hash encoding is a major efficiency driver. The authors mathematically demonstrate that even with 10 million distinct tokens, the probability of a hash collision is a negligible 0.000271%, completely justifying the elimination of token-to-ID dictionaries.
  • Decoupling Training Structure from Matching Execution: While hierarchical trees are excellent for discovering templates and enabling multi-granularity queries, traversing them for every single incoming log is too slow. Matching logs directly against a flat list of text templates sorted by saturation score yields SOTA-level accuracy at a fraction of the compute cost.

Key Results

ByteBrain achieves an unprecedented balance of speed and accuracy, making it highly competitive for cloud-scale deployment.

Figure 2: Our method meets the goal of high throughput and near-SOTA accuracy
  • Throughput: ByteBrain processed an average of 229,000 logs per second, outperforming the fastest baseline (LogCluster) by 840.68% and beating deep learning/LLM methods by 1 to 3 orders of magnitude. On the massive Thunderbird dataset, throughput reached 519,000 logs/sec.
  • Accuracy: It achieved an average Group Accuracy of 0.98 on LogHub and 0.90 on LogHub-2.0, closely trailing the absolute top-performing LLM baseline (LILAC at 0.99/0.93), which is too slow for production use.
  • Production Deployment: Successfully deployed within Volcano Engine’s Torch Log Service (TLS) at ByteDance, the system handles real-world production volumes up to 189 MB/s (millions of logs/sec) with an end-to-end visible query latency of just 5–15 seconds.

Limitations and Future Work

Despite its strengths, the authors note two primary limitations:

  1. Lack of Semantic Understanding: As a syntax-based parser, ByteBrain relies purely on structural token distributions. It cannot naturally group logs based on human-like semantic meaning if the syntax differs significantly.
  2. Variable-Length Elements: Like most syntax-based parsers, it struggles to cleanly parse logs where a single variable outputs a dynamic, variable-length list into a single template.

Future Work: The team aims to explore hybrid frameworks that combine the compute efficiency of syntax-based parsing with the semantic intelligence of lightweight language models, alongside better handling of structural and dynamic-length variables.

Summary updated

BibTeX
@misc{li2025adaptive,
  author = {Zeyan Li and Jie Song and Tieying Zhang and Tao Yang and Xiongjun Ou and Yingjie Ye and Pengfei Duan and Muchen Lin and Jianjun Chen},
  title = {{Adaptive and Efficient Log Parsing as a Cloud Service}},
  year = {2025},
  eprint = {2504.09113},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.09113},
}
Figure