frankdekker / symfony-log-viewer-bundle

A log viewer for Symfony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License Minimum PHP Version Minimum Symfony Version Vuejs codecov Run tests

Log viewer for Symfony

Inspired by opcodesio/log-viewer for Laravel log-viewer

Log Viewer: a bundle for your Symfony app. It provides a user-friendly UI to read, filter and search log files.

Out of the box it will read your Monolog logs in the var/log directory, but can be configured to read logs from any directory.

Features

  • πŸ“‚ View all the Monolog logs in the %kernel.logs_dir% directory,
  • πŸ“‚ View other types of logs - Apache, Nginx, or custom logs,
  • πŸ” Search the logs,
  • πŸ” Filter by log level (error, info, debug, etc.), by channel, date range or log content inclusion or exclusion,
  • πŸ” Search multiple log files at once,
  • πŸŒ‘ Dark mode,
  • πŸ–₯️ Multiple host support,
  • πŸ’Ύ Download or delete log files from the UI,
  • ☎️ API access for folders, files & log entries,

Getting started

Requirements

  • PHP 8.1+
  • Symfony 6.0+ or 7.0+

Installation

Use composer.

composer require fdekker/log-viewer-bundle

If you don't use Symfony Flex, you'll need to manually enable the bundle:

# /config/bundles.php
return [
    // ...
    FD\LogViewer\FDLogViewerBundle::class => ['all' => true],
];

And add the route by creating file /config/routes/fd_log_viewer.php:

<?php
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return static function (RoutingConfigurator $routingConfigurator): void {
    $routingConfigurator->import('.', 'fd_symfony_log_viewer')->prefix('/log-viewer');
};

⚠ Ensure access to your logs are secure by adding the line below to /config/packages/security.php:

return static function (SecurityConfig $security): void {
    ...
    $security->accessControl()->path('^/log-viewer')->roles(['ROLE_ADMIN']);
};

After installing the package, publish the front-end assets by running:

php bin/console assets:install

Usage

Once the installation is complete, you will be able to access Log Viewer directly in your browser.

By default, it is available at: /log-viewer on your domain.

Configuration

About

A log viewer for Symfony

License:MIT License


Languages

Language:PHP 86.1%Language:Vue 8.4%Language:TypeScript 3.3%Language:Shell 0.7%Language:SCSS 0.6%Language:Twig 0.5%Language:Dockerfile 0.3%Language:JavaScript 0.1%