SmartLog is a high-performance terminal user interface (TUI) designed for efficient log tailing with real-time JSON auto-detection and filtering capabilities. It provides developers and system administrators with a powerful tool to monitor, filter, and analyze logs in real time.
Key Features:
Auto-Detects Log Types: Automatically identifies and formats JSON logs or plain-text content.
Real-Time Filtering: Instantly filters logs using keywords or regex patterns for quick analysis.
Log Level Management: Filters by log severity (ERROR, WARN, INFO, DEBUG) to focus on relevant information.
File Handling: Continuously tails files like tail -f, handling rotations and truncations seamlessly.
Mouse Support: Enables easy navigation with mouse wheel scrolling.
Audience & Benefit:
Ideal for developers, DevOps engineers, and system administrators who need to monitor logs efficiently. SmartLog streamlines log analysis by combining real-time filtering with intuitive navigation, enabling users to quickly identify issues and trends in their applications or systems.
README
SmartLog
A fast, ergonomic terminal UI for tailing and filtering JSON and plain-text logs in real time.
Built with Rust • Async I/O with Tokio • Beautiful TUI with Ratatui.
✨ Features
Auto-detects JSON vs. plain text
Pretty-prints JSON with level coloring
Live filtering with instant highlight (/ to search)
When using --file, SmartLog tails from the end of the file and follows new lines (similar to tail -f). If the file is truncated/rotated, it continues from the beginning of the new file.
When no --file is provided, SmartLog automatically reads from stdin if it is piped; otherwise it starts a demo stream.
Press Ctrl+C to exit gracefully. On Unix, receiving SIGTERM also exits gracefully and restores the terminal state.
Cycle color theme (dark → light → solarized → dracula)
Mouse wheel
Scroll up/down
q
Quit application
🔎 Filter Mode
Press / to enter filter mode
Type your search query (case-insensitive)
Press Enter to apply filter and return to normal mode
Press ESC to clear the filter and return to normal mode
Matching text is highlighted with a cyan background for easy visibility. Highlighting works in both substring and regex modes.
Regex Filtering
Press r to toggle regex mode. When active, the filter input is treated as a regular expression (case-insensitive). Regex matches are highlighted in the log output, supporting patterns like \d+, error|warn, etc. Invalid regex patterns are indicated in the status bar.
Log Level Filtering
Press l to cycle through minimum log level filters: ALL → ERROR → WARN → INFO → DEBUG → ALL. Only entries at or above the selected severity are shown. This filter combines with the text/regex filter (both must match).
Export Logs
Press e to export the currently filtered logs to a file. The file is saved as smartlog_export__.log in the current directory (or the directory specified by --export-dir). The status bar shows confirmation with the file path.
Debug Logging
Use --verbose (or -v) to enable debug logging. Diagnostic output is written to smartlog_debug.log in the current directory by default. Use --debug-log to write to a custom location. This is useful for troubleshooting SmartLog itself.
Relative Timestamps
Press t to toggle relative timestamp display. When enabled, each log entry with a detected timestamp shows a prefix like [3s ago], [5m ago], or [2h ago]. The display auto-refreshes every 30 seconds to keep values current while idle. Timestamps are extracted from:
JSON logs: timestamp, ts, time, @timestamp, datetime, date fields (ISO 8601 strings or Unix epoch seconds/milliseconds/microseconds)
Plain text logs: ISO 8601 or common date/time patterns at the beginning of the line, including YYYY-MM-DD and YYYY/MM/DD formats (e.g., 2024-01-15T10:30:45Z, 2024-01-15 10:30:45, 2024/01/15 10:30:45)
Multi-File Tailing
Tail multiple files simultaneously by specifying --file multiple times:
Each log entry is prefixed with the source filename (e.g., [app.log]) so you can tell which file it came from. The status bar shows the number of active files.
Color Themes
Use --theme to set the color theme, or press T at runtime to cycle through themes:
dark (default): Designed for dark terminal backgrounds
light: Designed for light terminal backgrounds
solarized: Based on the Solarized color palette
dracula: Based on the Dracula color palette
The current theme name is shown in the status bar.
📊 Log Format Support
SmartLog intelligently handles various log formats:
JSON Logs
Automatically detects and pretty-prints JSON with level detection:
SmartLog is built with modern Rust async patterns:
Tokio — Async runtime for non-blocking I/O
Ratatui — Terminal UI framework
Crossterm — Cross-platform terminal manipulation
Serde JSON — Fast JSON parsing and pretty-printing
Performance
Async non-blocking streaming: Logs are processed as they arrive without blocking
Efficient buffering: Maintains last 2000 logs in memory (configurable in code)
Async I/O: File tailing and terminal rendering happen concurrently
Fast JSON parsing: Uses serde_json for high-performance parsing
Reliability
Graceful shutdown: Handles SIGINT (Ctrl+C) and SIGTERM cleanly
Terminal restoration: Always restores terminal state, even on panic
File rotation handling: Automatically detects and recovers from log rotation
Error recovery: Continues running even if temporary errors occur
🧰 Troubleshooting
If nothing appears when you run smartlog without --file, make sure you're piping input (e.g., ... | smartlog). If stdin is a TTY and no file is provided, SmartLog shows a demo stream.
Permissions: ensure smartlog has read access to any files you tail.
Windows: make sure your terminal supports the necessary VT sequences (Windows 10+ typically works).
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add some amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request
📝 License
This project is licensed under the MIT License — see the LICENSE file for details.
🐛 Bug Reports & Feature Requests
Found a bug or have a feature request? Please open an issue on GitHub.