A web-based syslog viewer that provides real-time log monitoring and historical log search capabilities.
- Live View: Real-time monitoring of syslog entries with automatic refresh
- Archive Search: Search through historical logs with date range filtering
- Files Management: View and manage log files, including manual rotation
- Log Rotation: Automatic log rotation based on size and age, with configurable retention policies
- Embedded syslog-ng: Built-in syslog server for direct log collection
- Filtering: Filter logs by host, facility, level, program, and PID
- Message Search: Search within log messages
- Responsive Design: Modern UI that works on both desktop and mobile devices
The live search functionality is implemented through two main components:
-
back.pycontinuously monitors the log file using inotify, reads new lines, parses them into a structured format (timestamp, host, facility, etc.), and maintains a fixed-size buffer in memory (default 1000 lines) by removing oldest entries when the buffer is full. -
front.pyprovides a web page that displays the logs and automatically refreshes every 2 seconds by calling an API endpoint that returns the latest buffer contents fromback.py.
- Clone the repository:
git clone https://github.com/ptempier/syslog-web-viewer.git
cd syslog-web-viewer- Build and run with Docker:
docker build -t syslog-web-viewer .
docker run -d --name logserver -p 7321:7321 -p 7322:7322/udp -v /var/log:/var/log syslog-web-viewerOr using docker-compose:
docker-compose up -dAccess the web interface at http://localhost:7321
- Real-time monitoring of syslog entries
- Configurable refresh interval
- Automatic scrolling to new entries
- Filter by host, facility, level, program, and PID
- Search through historical logs
- Date range selection with timezone support
- Filter by host, facility, level, program, and PID
- Message content search
- Configurable number of results
- View all log files with their sizes and last modified dates
- Manual log rotation with "Rotate Now" button
- Automatic log rotation based on size and age
- Compressed archive files with date ranges in filenames
- Automatic rotation based on file size and age
- Configurable rotation policies:
- Maximum file size
- Maximum age
- Retention period
- Minimum number of files to keep
- Compressed archive files with date ranges
- Manual rotation trigger
- Built-in syslog server on port 7322 (UDP)
- Direct log collection from network devices
- No additional syslog server required
- Configurable through web interface
The application can be configured through the web interface:
- Log file paths
- Rotation settings (size, age, retention)
- Buffer settings
- Authentication credentials
- syslog-ng settings
logserver/
├── front.py # Web interface and routes
├── back.py # Log monitoring and processing
├── rotate.py # Log rotation and archiving
├── search_live.py # Live search functionality
├── search_archive.py # Archive search functionality
├── files.py # Files management functionality
├── settings.py # Configuration management
├── utils.py # Shared utilities
├── templates/ # HTML templates
└── static/ # CSS and JavaScript files