Skip to content

Easily view your Flarum logfiles from within the admin interface

License

Notifications You must be signed in to change notification settings

imorland/flarum-ext-log-viewer

Repository files navigation

Log Viewer

License Latest Stable Version Total Downloads

Easily view your Flarum logfiles from within the admin interface.

This utility extension offers access to Flarum's logfiles without the need for command line access to your server. It exposes the contents of files found in the {flarum_install_dir}/storage/logs directly to the admin interface, or optionally via the API.

This is especially useful if you have either limited knowledge of SSH access/commands, or you are using a host where this is simply not permitted. So long as the Flarum logger has not been modified to store logs elsewhere (usually only on multi-instance, scalable hosting solutions), then this extension will work for you!

Need to access the logs in order to troubleshoot a problem you're having with your forum? Simply login as an admin account and look for any trouble signs in the log viewer. Simple, just be sure to review any log snippets you share with others, as they may contain sensitive data.

Subject to the Flarum scheduler being active, logfiles are purged from you log folder once they are more than 90 days old. A setting is provided to adjust this up/down to suit your requirements. A value of 0 will disable purging.

Screenshots

log viewer log viewer mobile

API Usage

Two API endpoints are provided to enable the logs to be easily extracted from Flarum into another system. Permissions to access these endpoints are provided, and restriced to admin users only by default, although you may create a dedicated permission group and apply log access to that group as well for log retrieval without full admin permissions. NEVER GRANT LOG ACCESS TO REGULAR USERS.

Permission can be set within the extension page, or the global Permissions tab permission

Once authenticated, a GET request can be made to /api/logs to list the available log files.

To retrieve a particular file, another GET request should be made to /api/logs/{filename}

Future changes/features

  • Add option to download a file from the admin interface
  • Add option to delete a file from the admin interface
  • Add feature to tail new logfile content and stream this into the viewer

Installation

Install with composer:

composer require ianm/log-viewer

Updating

composer update ianm/log-viewer
php flarum cache:clear

Links

About

Easily view your Flarum logfiles from within the admin interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •