Installation:
composer require danilovl/log-viewer-bundle
Add to config/bundles.php and run php bin/console assets:install.
Basic Configuration:
Create config/packages/danilovl_log_viewer.yaml with minimal settings:
danilovl_log_viewer:
sources:
dirs: ['%kernel.logs_dir%']
First Use Case:
Access /danilovl/log-viewer to view logs. Use the File Reader to inspect large log files incrementally.
Log Discovery & Filtering:
sources.dirs to include log directories (e.g., %kernel.logs_dir%).sources.ignore to exclude files (e.g., ['cache.log'])./danilovl/log-viewer/search) for cross-file queries with regex support.Real-Time Monitoring:
live_log_page:
enabled: true
interval: '3 sec'
levels: ['error', 'critical']
Remote Logs:
remote_hosts:
- name: 'prod_server'
type: 'ssh'
host: '1.2.3.4'
user: 'deploy'
ssh_key: '%kernel.project_dir%/config/ssh/id_rsa'
dirs: ['/var/log']
Parser Optimization:
parser:
go_enabled: true
overrides:
'/var/log/nginx/access.log': 'nginx_access'
API Integration:
GET /danilovl/log-viewer/api/logs?file=/var/log/app.log&limit=50
GET /danilovl/log-viewer/api/statistics?file=/var/log/app.log
AI-Assisted Debugging:
ai.chats and enable for error levels:
ai:
button_levels: ['error', 'critical']
chats:
- { name: 'ChatGPT', url: 'https://chatgpt.com/?q={prompt}' }
danilovl:log-viewer:watch command for real-time alerts:
php bin/console danilovl:log-viewer:watch --interval=5 --limit=100
framework.default_locale.File Permissions:
allow_delete/allow_download require web server write/read access to log files.ssh/sftp) need ssh2 PHP extension and valid credentials.Go Parser Dependency:
go_enabled: true, ensure the binary at go_binary_path exists and is executable.php bin/console danilovl:log-viewer:debug
Regex Performance:
max_file_size to limit parsing:
sources:
max_file_size: 10485760 # 10MB
Caching Quirks:
cache.parser_detect_enabled caches parser detection but may stale if log formats change.php bin/console cache:clear
Live Logs Latency:
live_log_page.interval values (e.g., 1 sec) increase server load. Test with 3-5 sec first.Log Parser Errors:
var/log/dev.log) for parser failures.parser.overrides to bypass auto-detection.API Issues:
GET /danilovl/log-viewer/api/health
Vue SPA Errors:
yarn build
php bin/console assets:install
Custom Parsers:
Danilovl\LogViewerBundle\Parser\ParserInterface for new log formats (e.g., custom app logs).parser.overrides or dynamically in a service.Notifier Rules:
danilovl.log_viewer.notification events.UI Customization:
templates/bundles/logviewer/ to modify the SPA.assets/css/log-viewer.css.API Extensions:
Danilovl\LogViewerBundle\Controller\ApiController for additional endpoints.Bookmark Sync:
BookmarkManager service.Monitor Critical Paths:
Combine live_log_page.levels with notifier.rules to alert on errors and stream them in real-time:
live_log_page:
levels: ['error', 'critical']
notifier:
rules:
- levels: ['error', 'critical']
channels: ['chat/slack']
Offload Heavy Parsing: Use the Go parser for production logs and disable it locally:
parser:
go_enabled: '%kernel.environment% === "prod"'
Bookmark Workflows: Train ops teams to use Bookmarks for recurring issues (e.g., "star" errors from a specific endpoint).
Dark Mode Optimization:
Prefer prefers-color-scheme over manual toggles for accessibility:
:root {
--log-viewer-bg: #121212;
}
@media (prefers-color-scheme: light) {
:root {
--log-viewer-bg: #ffffff;
}
}
How can I help you explore Laravel packages today?