111 líneas
2.9 KiB
Markdown
111 líneas
2.9 KiB
Markdown
# 🚀 Log Tail Monitor
|
|
|
|
A modern, beautiful real-time log monitoring application with a web interface. Monitor your log files in real-time using Server-Sent Events (SSE) with advanced filtering, highlighting, and export capabilities.
|
|
|
|

|
|
|
|
## ✨ Features
|
|
|
|
- **🔄 Real-time Monitoring**: Uses Server-Sent Events for instant log updates
|
|
- **🎨 Modern UI**: Beautiful, responsive interface with dark/light mode support
|
|
- **🔍 Advanced Filtering**: Filter logs by content with real-time search
|
|
- **✨ Smart Highlighting**: Highlight important text with visual indicators
|
|
- **📊 Log Classification**: Automatic classification of log levels (success, error, warning, info)
|
|
- **💾 Export Functionality**: Export filtered logs to text files
|
|
- **⏸️ Pause/Resume**: Control log streaming as needed
|
|
- **📱 Mobile Responsive**: Works great on all device sizes
|
|
- **🔒 Secure**: Path traversal protection and proper error handling
|
|
- **⚡ High Performance**: Handles thousands of log lines efficiently
|
|
|
|
## 🚀 Quick Start
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js 14.0.0 or higher
|
|
- npm (comes with Node.js)
|
|
|
|
### Installation
|
|
|
|
1. Clone or download this repository
|
|
2. Install dependencies:
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
### Running the Application
|
|
|
|
#### Production Mode
|
|
```bash
|
|
npm start [directory]
|
|
```
|
|
|
|
#### Development Mode (default ./logs directory)
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
#### Demo Mode (with sample logs)
|
|
```bash
|
|
npm run demo
|
|
```
|
|
|
|
### Example
|
|
```bash
|
|
# Monitor logs in /var/log directory
|
|
npm start /var/log
|
|
|
|
# Monitor logs in current directory's logs folder
|
|
npm run dev
|
|
|
|
# Run demo with sample data
|
|
npm run demo
|
|
```
|
|
|
|
## 🌐 Usage
|
|
|
|
1. **Access the Web Interface**: Open your browser and go to `http://localhost:3000/tail`
|
|
|
|
2. **Select a File**: Choose a log file from the sidebar to start monitoring
|
|
|
|
3. **Filter Logs**: Use the filter input to show only logs containing specific text
|
|
|
|
4. **Highlight Text**: Use the highlight input to emphasize important content
|
|
|
|
5. **Control Playback**:
|
|
- Toggle auto-scroll on/off
|
|
- Pause/resume log streaming
|
|
- Clear current logs
|
|
- Export filtered results
|
|
|
|
6. **Interact with Logs**: Click on any log line to expand it for better readability
|
|
|
|
## 🔧 API Endpoints
|
|
|
|
### REST API
|
|
|
|
- `GET /tail/api/health` - Health check and status
|
|
- `GET /tail/api/files` - List available log files
|
|
- `GET /tail/api/files/:filename` - Stream specific file (SSE)
|
|
|
|
## ⚙️ Configuration
|
|
|
|
### Command Line Arguments
|
|
|
|
```bash
|
|
node index.js [log-directory]
|
|
```
|
|
|
|
- `log-directory` - Path to directory containing log files (default: ./logs)
|
|
|
|
## 🎨 Log Classification
|
|
|
|
The application automatically classifies log lines:
|
|
|
|
- **🟢 Success**: HTTP 2xx responses, successful operations
|
|
- **🔴 Error**: HTTP non-2xx responses, errors, failures
|
|
- **🟡 Warning**: Warning messages
|
|
- **🔵 Info**: General information, bot traffic
|
|
|
|
## 📝 License
|
|
|
|
MIT License - see LICENSE file for details |