LogTrie: Adaptive Trie-Structured Compression with Query Support for Streaming Logs
摘要
Streaming JSON logs are widely used in modern cloud-native systems for their flexibility and expressiveness, but they pose significant challenges for storage and query efficiency. Existing compressors either achieve high compression at the expense of queryability or support only limited query patterns, leaving residual redundancy. In this work, we present LogTrie, a system that jointly optimizes compression and query performance for large-scale JSON logs. The novelty of LogTrie lies in two aspects. First, we propose a trie-based representation framework for streaming JSON logs that separates structure from values and further eliminates value redundancy. Second, we present a two-stage compression pipeline for encoding JSON log structures using type-aware, layer-wise algorithms. Unlike existing compressors, which prioritize compression efficiency at the expense of query performance, LogTrie can deliver high query performance while maintaining compression efficiency. We evaluate LogTrie on 18 real-world JSON log datasets and compare it with five existing compressors, including three general-purpose compressors (Gzip, Zstandard, and LZMA) and two state-of-the-art log compressors ( \(\mu \) Slope and LogLite). The results show that LogTrie achieves an average compression of 59.56 \(\times \) , outperforming \(\mu \) Slope by 41%, and reduces query latency by up to 46.6% on aggregation queries.