systems · search · data structures
C++ CLI that loads a large timestamped log, supports several search modes, and lets me build an excerpt list of the lines that matter.
// overview
It loads a master log shaped like timestamp|category|message, then opens an interactive prompt. I can search by time range, exact time, category, or keywords, then append, delete, or reorder hits into an excerpt list to print.
// architecture
Lookup tables are built once on load so searches avoid a full scan. Categories and keywords use hash maps; timestamps stay sorted for range queries.
Search hits go into a separate list I can edit (append, delete, move, sort, print). The original log doesn’t get mutated.
// stack
vector, unordered_map, string, <algorithm>g++ with -O3// concepts
unordered_map is built once so category and keyword lookups stay near O(1) instead of scanning the full file each time.
Times stay ordered so range / exact searches stay fast without rebuilding a new structure for every query.
Hits go into a separate list I can rearrange. The master log stays read-only; the excerpt is the working set.
Compare in lowercase, but print the original line so formatting in the log is preserved.
// design choices
Scanning a large log on every search is too slow. Most of the work was choosing what to index up front so category and keyword lookups stay fast, time ranges stay memory-efficient, and the CLI stays practical to use.