C++ Interactive Log Manager
In professional software, rather than outputting messages to the standard output stream for the purpose of debugging or indicating errors, developers will typically use log files to hide such information from end-users. Log files are usually quite massive in size and there are often many log entries that may be irrelevant to what the developer is trying to examine. The developer needs to have the ability to quickly search for and analyze only the entries they care about. This project is designed to helps with this task, by creating an interactive manager to search, parse, and edit log files.
Compile all files with make all
Run on an example log with logman example-log.txt
This project also supports input and output redirection.
Run with logman example-log.txt < example-cmds.txt > example-output.txt
Makefile builds an executable program called logman
. The program will begin by reading an input file containing log entries, and then will enter an interactive mode where the user can perform timestamp, category, and keyword searches for the purpose of constructing an “excerpt list” of the log file. logman
also allows the user to manage and display this “excerpt list” to identify the important/relevant entries of their log file.
On startup, logman
reads a series of log entries from the master log file, a file specified via the command line. The file is a plain text file which describes a single log entry on every line. Each log entry consists of three fields separated by vertical bar (|
) characters. The first field contains the timestamp of the log entry, the second contains the category of the log entry, and the third contains the message of the log entry. The following is a description of the formats of each field:
Log timestamps will be given in the format mmhh
ss , where the various components (month, day, hour, minute, second) between colons are given as a pair of digits.
Log categories will be given as strings and correspond to some general, but meaningful, description of which part of the logged program outputted the message.
Log messages will be given as strings.
An example of two lines from the master log file:
10:09:03:45:50|TCP|Packet 0x4235124 sent
09:15:12:00:00|Clock|Noon 09/15
Search Commands:
t
- timestamp search% t <timestamp1>|<timestamp2>
m
- matching search% m <timestamp>
c
- category search% c <string>
k
- keyword search% k <string>
Excerpt List Commands:
a
- append log entry (by entryID)% a <integer>
r
- append search results% r
d
- delete log entry (by excerpt list number)% d <integer>
b
- move to beginning (by excerpt list number)% b <integer>
e
- move to end (by excerpt list number)% e <integer>
s
- sort excerpt list (by timestamp)% s
l
- clear excerpt list% l
Output Commands:
g
- print most recent search results% g
<entryID>|<timestamp>|<category>|<message><newline>
p
- print excerpt list% p
Miscellaneous Commands:
q
- quit% q
#
- no operation% # <string>
h
- help% h
This project helped me gain experience writing code that makes use of multiple interacting data structures. The design portion of this project was significant; spending plenty of time thinking about what data structures to use and how they will interact.
I’ve gained valuable experience selecting appropriate data structures for a given problem, as well as how to use various abstract data types.