20% off on Spike Billing!

Default Log Types

Log Viewer v3 now supports reading additional types of logs. It comes with a few pre-built log parsers already:

Log typeLog class
laravelOpcodes\LogViewer\Logs\LaravelLog
horizonOpcodes\LogViewer\Logs\HorizonLog
horizon_oldOpcodes\LogViewer\Logs\HorizonOldLog
http_accessOpcodes\LogViewer\Logs\HttpAccessLog
http_error_apacheOpcodes\LogViewer\Logs\HttpApacheErrorLog
http_error_nginxOpcodes\LogViewer\Logs\HttpNginxErrorLog
php_fpmOpcodes\LogViewer\Logs\PhpFpmLog
postgresOpcodes\LogViewer\Logs\PostgresLog
redisOpcodes\LogViewer\Logs\RedisLog
supervisorOpcodes\LogViewer\Logs\SupervisorLog

All of these extend the base log class, Opcodes\LogViewer\Logs\Log.

In order to start reading these types of logs, make sure to include the related paths in the config/log-viewer.php configuration.

Extending a pre-built log type

In some cases your logs may vary, and you might need to adjust the Regular Expression used, or to capture additional data points. In that case, it's useful to create your own Log class that extends the pre-built class from Log Viewer, and register it within the Log Viewer.

For example, suppose you need to extend the laravel type. You would first create your own LaravelLog class that extends (optionally) the Log Viewer's class:

use Opcodes\LogViewer\Logs\LaravelLog;class CustomLaravelLog extends LaravelLog{    //}

Make any modifications you need (refer to the Custom Log Types page for information on the available configuration options), and then register your class in the AppServiceProvider:

use Opcodes\LogViewer\Facades\LogViewer;/** * Bootstrap any application services. * * @return void */public function boot(){    LogViewer::extend('laravel', CustomLaravelLog::class);}

Your provided Log class will take precedence over the Log Viewer ones, but if it does not match a particular log file, it will then fall back to the Log Viewer's default implementation.

Log Viewer assumes that a single file contains only one format (i.e. Horizon logs should not be mixed with Laravel logs in the same file).

Support

If you have any questions, feedback, or need any help setting up Log Viewer within your project, feel free to reach out via GitHub Discussions or GitHub Issues .