Abstract
Log data is a vital resource for capturing system events and states. With the increasing complexity and widespread adoption of modern software systems and IoT devices, the daily volume of log generation has surged to tens of petabytes, leading to significant collection and storage costs. To address this challenge, lossless log compression has emerged as an effective solution, enabling substantial resource savings without compromising log information. In this paper, we first conduct a characterization study on extensive public log datasets and identify four key observations. Building on these insights, we propose LogLite, a lightweight, plug-and-play, streaming lossless compression algorithm designed to handle both TEXT and JSON logs throughout their life cycle. LogLite requires no predefined rules or pre-training and is inherently adaptable to evolving log structures. Our evaluation shows that, compared to state-of-the-art baselines, LogLite achieves Pareto optimality in most scenarios, delivering an average improvement of up to 67.8% in compression ratio and up to 2.7× in compression speed.
Introduction
Modern distributed systems and IoT devices generate staggering amounts of data. For instance, Uber alone produces over 10 petabytes of logs daily. Storing and transmitting this data is incredibly expensive, yet logs are indispensable for debugging, security auditing, and system monitoring.
Existing solutions for log compression generally fall into two categories, both of which present significant drawbacks for real-time streaming environments:
- General-purpose compressors (e.g., Zstd, LZMA): These treat logs as raw byte streams. While robust and easy to deploy, they fail to exploit the repetitive "template" structure inherent in log data, leading to sub-optimal compression ratios.
- Log-specific compressors: These typically rely on log parsing to extract templates and variables. However, parsing is computationally expensive, often requires manual rule-writing or offline training, and is fragile; it frequently breaks when developers update log message formats.
The challenge lies in creating a "streaming" compressor that is lightweight enough for resource-constrained edge devices, fast enough for real-time ingestion, and adaptive enough to handle evolving log formats without human intervention.
The LogLite Architecture
LogLite is designed as a "plug-and-play" solution that operates without pre-training or manual configuration. Its effectiveness stems from three core components:
1. L-Windows (Length-Windows)
Instead of performing complex semantic analysis or NLP-based template extraction, LogLite leverages a simple but powerful observation: log length is a highly reliable proxy for structural similarity. In 90-99% of cases, logs of the same length belong to the same code-level template. LogLite uses a hash table where the key is the length of the log entry, maintaining small FIFO (First-In-First-Out) queues of the most recent logs for each specific length.
2. XOR-P (XOR-Preserve)
When a new log arrives, LogLite identifies a similar log of the same length within the corresponding L-Window. It then performs a bitwise XOR operation. Identical characters are reduced to null bytes (\0). Crucially, LogLite employs a "Preserve" step that keeps the original characters for non-matching positions rather than the XOR result. This design choice prioritizes decompression speed, allowing the system to simply "fill in the blanks" from the reference log without performing inverse XOR mathematics.
3. RLE-b/B (Run-Length Encoding)
Because the XOR-P process results in strings dominated by null bytes, LogLite applies Run-Length Encoding to compress these runs of zeros. Two variants are provided:
- RLE-b (Bit-aligned): Optimized for high-speed real-time transmission.
- RLE-B (Byte-aligned): Designed to be "friendly" to downstream general-purpose compressors like Zstd for long-term archiving.
Key Insights
- Temporal Locality: Similar logs tend to appear close together in time. By searching only a small window (e.g., the last 8–32 logs of a specific length), LogLite finds matches rapidly with minimal memory overhead.
- Decompression-First Design: By preserving original characters in the XOR-P phase, the authors ensure that "cold" logs can be searched or analyzed quickly after retrieval from archives, minimizing the CPU overhead of restoration.
Evaluation and Results
The researchers evaluated LogLite on 21 real-world datasets totaling over 140 GB, including 16 unstructured TEXT datasets (from the Loghub benchmark) and 5 semi-structured JSON datasets (from the μSlope benchmark).
LogLite demonstrated Pareto optimality in nearly all tested scenarios, providing the best trade-off between speed and compression ratio:
- Compression Ratio: On JSON logs, LogLite improved the compression ratio by an average of 67.8% over the next best specific-purpose compressor (PBC-F).
- Speed: It achieved up to 2.7× faster compression speeds compared to state-of-the-art baselines.
- Throughput: In a case study involving PostgreSQL, LogLite handled a massive load of 2.24 million log rows per second, significantly outperforming Zstd and PBC, which hit performance bottlenecks much earlier.
Conclusion and Future Work
LogLite offers a significant advancement in streaming log compression by replacing heavy parsing with simple length-based heuristics. While highly effective, its reliance on exact length matches can be a limitation when log templates contain variables with drastically varying lengths (e.g., a short username vs. a very long URL).
Future research may explore "fuzzy" length matching or the use of SIMD (Single Instruction, Multiple Data) hardware instructions to further accelerate the RLE components. Additionally, the authors suggest exploring "querying over compressed data" to allow for analysis without full decompression.
Summary updated