note: rewrite the TUI as an independent library
Terminal-based log analytics engine for ingesting, parsing, indexing, and searching logs with SPL-like query syntax.
CoreSight processes log files, extracts structured data, stores it in SQLite, and provides search and analytics capabilities through a terminal interface. If you have log files, then CoreSight can parse them. If you need to search logs, then CoreSight provides a query interface. If you want analytics, then CoreSight generates visualizations.
- Supports three log types: syslog, web access logs, and authentication logs
- Automatic log type detection based on filename or content
- Batch processing for large files
- Handles multiple timestamp formats
- SPL-like query syntax for flexible searching
- Keyword search across all log fields
- Field-based filtering with exact or partial matches
- Time-based filtering with relative and absolute date ranges
- Statistical analysis with aggregation functions
- Pre-built dashboards for common metrics
- Terminal-based visualizations (bar charts, line charts, tables)
- Real-time statistics and aggregations
- Time-based bucketing for trend analysis
- Custom TUI library for interactive navigation
- Menu-driven interface for all operations
- Scrollable results and dashboard views
- Keyboard-based navigation
If you have Python 3.7 or later, then CoreSight requires no external dependencies. All functionality uses the Python standard library.
python main.pyThe application starts with a main menu offering four options:
- Ingest Logs - Import log files into the index
- Run Search Query - Execute SPL-like queries
- View Dashboards - View analytics dashboards
- Exit - Quit the application
- ↑/↓ - Navigate menu options and scroll results
- Enter - Select option or execute search
- ESC - Return to menu or cancel operation
- q - Quit application
- ←/→ - Navigate between dashboard sections
If you select "Ingest Logs" from the menu, then you can enter a file path. The system automatically detects the log type based on the filename or content.
Example paths:
sample_logs/syslog_sample.log
sample_logs/access_sample.log
sample_logs/auth_sample.log
/var/log/auth.log
/var/log/syslog
/var/log/nginx/access.log
If you want to search logs, then use the SPL-like query syntax. If you want keyword search, then enter a word or phrase. If you want field filtering, then use field=value syntax. If you want time filtering, then use last=X or earliest=X syntax.
Search for text across all log fields:
service
start
stop
nginx
systemd
Failed
Filter by specific fields with exact or partial matches:
status=404
user=admin
log_type=access
service=systemd
ip=192.168.1.1
method=GET
action=login_failure
Filter logs by time using relative or absolute dates:
last=15m
last=1h
last=24h
last=7d
earliest=-1h
earliest=-24h
earliest=2025-01-01
latest=2025-01-13
latest=now
Combine multiple filters:
service=systemd last=1h
status=404 earliest=2025-01-01 latest=2025-01-13
Failed earliest=-7d
Perform statistical analysis on search results:
* | count_by(log_type)
* | count_by(status)
* | top(10, ip)
* | time_bucket(1h)
* | stats count
If you select "View Dashboards", then you can navigate through pre-built analytics:
- HTTP Status Codes - Status code distribution from access logs
- Events Over Time - Line chart showing event frequency over time
- Top IP Addresses - Most active IP addresses
- Failed Login Attempts - Failed logins grouped by user
- Logs per Service - Service distribution from syslog
Use ←/→ arrow keys to navigate between dashboards.
Fields: timestamp, host, service, message
Supports both classic syslog format (Jan 12 11:33:22) and ISO timestamp format (2025-01-12T11:33:22).
Fields: timestamp, ip, method, endpoint, status, size
Compatible with nginx and Apache access log formats.
Fields: timestamp, user, action (login success/failure), ip
Parses SSH authentication events and other authentication-related logs.
If you want to add support for a new log format, then:
- Create a new parser in
parsers/directory - Implement a
parse(line: str) -> Optional[Dict]method - Return a dictionary with standardized field names
- Add the parser to
parsers/__init__.py - Update the log type detection in
utils/log_ingester.py
If you want to add a new dashboard, then:
- Add a method to
dashboard/dashboard.py - Use
query_engine.search()to get data - Use
chartsutilities to render visualizations - Add the dashboard to
build_all_dashboards()method
If you want to add a new stats command, then:
- Add parsing logic to
search/query_parser.pyin the_run_stats()method - Add execution logic to
search/query_engine.py - Implement the aggregation function
MIT
Professional terminal-based log analytics engine designed for portfolio and educational purposes.