Result caching in Log Viewer
Log Viewer creates and caches indices for your log files so that further navigation is much, much faster.
When new logs are added to a log file, Log Viewer only scans the difference. This is possible because logs are appended at the end of the file and previously added contents will never change.
Configuring cache driver for Log Viewer
Before you're able to configure this, make sure to first publish the configuration file.
By default, Log Viewer uses your application's default cache driver.
To use a different cache driver for Log Viewer, you can set it with an .env
variable LOG_VIEWER_CACHE_DRIVER=redis
or with a config option in config/log-viewer.php
:
/* |-------------------------------------------------------------------------- | Cache driver |-------------------------------------------------------------------------- | Cache driver to use for storing the log indices. Indices are used to speed up | log navigation. Defaults to your application's default cache driver. | */ 'cache_driver' => env('LOG_VIEWER_CACHE_DRIVER', null),
Disabling cache behaviour
At the moment it's not possible to disable caching behaviour.
But, if you'd like to prevent Log Viewer from saving lots of data to the cache, you might use Laravel's in-memory array
cache driver by setting .env
variable LOG_VIEWER_CACHE_DRIVER=array
. This way nothing will be persisted, but you will definitely notice slower loading times and higher memory usage when navigating the same file.
Clearing indices
If things ever go weird, and you feel like Log Viewer is not showing what it's supposed to, you might want to clear indices and let them rebuild.
Clearing indices via the UI
In order to clear the index for a single file, just open its menu and click on the "Clear index" button:
You can also clear all indices by clicking on the "Clear all indices" button in the top right corner:
Clearing indices via API requests
You can also clear indices via API calls, either clearing indices for individual files or whole folders.