A CLI tool to parse, filter, and analyze log files using saved formats, custom regex, or AI-based format detection. Works even with unknown or complex log structures.
- Saved Format: Use previously saved regex patterns.
- AI Mode: Sends sample log lines to Gemini API to generate a regex and timestamp format.
- Custom Regex: User provides a Python regex with named groups.
- Reads the log file line by line.
- Applies regex to extract
timestamp,level,source, andmessage. - Filters can be applied by level, date range, or keyword search.
- Save AI-detected or custom formats for future use.
- List or delete saved formats.
# AI-based detection
python main.py -i server.log --use-ai
# Custom regex
python main.py -i server.log --custom-regex "(?P<timestamp>.*?) - (?P<level>INFO|ERROR) - (?P<message>.*)" --timestamp-format "%Y-%m-%d %H:%M:%S"
# Use saved format
python main.py -i server.log --use-format apache- AI mode requires GEMINI_API_KEY environment variable.
- First 20 lines of the log are used for AI analysis.