TL;DR
LogShrink is a novel log compression framework that achieves superior compression ratios by identifying and exploiting the "commonality" (repeated patterns) and "variability" (predictable changes like increments) inherent in system logs. By combining a clustering-based sampler with a column-oriented storage strategy, it outperforms existing state-of-the-art tools by 16% to 356% while maintaining practical processing speeds.
What Problem Does This Paper Address?
Modern software systems generate an astronomical volume of log data—sometimes reaching petabytes per day. Storing this data for troubleshooting, security auditing, or compliance is prohibitively expensive; for a cloud provider, storing 1 PB of logs per day can cost nearly half a million dollars a month.
While general-purpose compressors (like gzip or lzma) are easy to use, they treat logs as simple text and miss out on the structural redundancies of log data. Existing log-specific compressors often fail to fully exploit the relationships between different parts of a log message (e.g., how a specific "Event" always appears with a specific "Component" name) or the predictable ways numerical variables change over time.
Methods
LogShrink operates through a four-stage pipeline:
- Log Parsing: It breaks raw logs into three structured components: headers (timestamps, levels), events (the static template), and variables (the dynamic parameters).
- Clustering-based Sequence Sampler: Because log data is highly imbalanced (a few types of events make up the vast majority of the file), LogShrink samples a small, representative set of log sequences. This allows the system to perform deep analysis without being bogged down by billions of lines.
- Commonality and Variability Analyzer:
- Commonality: Uses a "multiplicity score" and a delimiter-level Longest Common Subsequence (LCS) algorithm to find static patterns (e.g., identifying that
task#0-1andtask#1-2share atask#x-xstructure).
- Commonality: Uses a "multiplicity score" and a delimiter-level Longest Common Subsequence (LCS) algorithm to find static patterns (e.g., identifying that
- Variability: Uses a weighted entropy metric to determine if numerical variables follow a steady, predictable change (like a counter incrementing by 1). If they do, it stores only the differences (delta encoding), which takes up far less space.
- Compressor & Zip Tool: The data is reorganized into a column-oriented format (grouping all timestamps together, all event IDs together, etc.). This is a key innovation, as general-purpose compressors perform significantly better when similar data types are clustered. Finally, it uses a tool like
lzmafor the final shrink.
Datasets
The authors evaluated LogShrink using 16 public datasets from the widely recognized Loghub repository. These datasets cover a broad spectrum of systems:
- Distributed Systems: HDFS, Hadoop, Spark, Zookeeper, OpenStack.
- Supercomputers: BGL, HPC, Thunderbird.
- Operating Systems: Windows, Linux, Mac.
- Mobile & Server Apps: Android, HealthApp, Apache, OpenSSH, Proxifier. The total volume of logs used for testing exceeded 77 GB.
Key Insights and Ideas
- The Power of Columns: One of the paper's most impactful observations is that simply switching from row-oriented to column-oriented storage reduces compressed file sizes by 36% to 103%. This is because grouping identical data types (like a column of "INFO" strings) creates massive redundancy that compressors love.
- Imbalanced Distributions: The authors found that the top 3%–5% of log sequence types often account for over 50% of the total log volume. This justifies their sampling approach—you don't need to analyze every line to understand the structure of the whole file.
- Entropy as a Guide: By using weighted entropy to measure variability, LogShrink can mathematically decide whether it's more efficient to store a raw value or the difference between consecutive values.
Key Results
LogShrink consistently outperformed both general-purpose and log-specific baselines:
- Compression Ratio (CR): It exceeded baselines by 16% to 356% on average. On the Windows dataset, it achieved a staggering CR of 456.3 (meaning the compressed file is less than 0.25% of the original size), compared to 342.9 for the next best tool, LogReducer.
- Efficiency: While slower than tools written in C++ (like LogReducer), LogShrink (written in Python) remains practical, achieving an average speed of 2.95 MB/s. It was significantly faster (up to 273x) than LogZip, another popular Python-based tool.
- Ablation Success: The authors proved that their specific "Commonality and Variability" analyzer alone improved the compression ratio by an average of 23.12%.
Limitations and Future Work
- Language Bias: The current implementation is in Python. The authors acknowledge that porting the logic to a lower-level language like C++ or Rust would likely yield a 10x speedup, making it viable for real-time, high-throughput environments.
- Parser Sensitivity: The effectiveness of the compression is somewhat tied to the quality of the initial log parsing. If the parser fails to correctly identify variables, the "Variability" analyzer cannot do its job.
- Subject Systems: While 16 datasets is a robust sample, the authors plan to test on even more diverse software systems to ensure the "three observations" hold true universally.
Summary updated