Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Monolog Viewer

Monolog Viewer stats

Downloads
6.1K
Stars
273
Open Issues
32
Forks
67

View on GitHub →

An easy-to-use viewer for log files generated by Monolog (https://github.com/Seldaek/monolog)

Monolog Viewer

A viewer to nicely display log files generated by Monolog.

Mockup Credits

Installation & Setup

  1. Download Composer
  2. Execute php composer.phar create-project syonix/monolog-viewer install-directory/ (make sure to replace install-directory with the name of the directory you want to install monolg viewer into.
  3. Upload the files to your webspace
  4. Make sure PHP has write access to the directory /app/config/secure - This is where the password hash will be stored (see below). Write access can be achieved by either changing the folder's chmod to 777 (less secure) or making sure that the owner of the file is the same as the one the server is using.
  5. Create a configuration file (rename or copy the config_example.yaml).
  6. Open Monolog Viewer in the browser
  7. Enter a password of your choice twice and click "Create login".
  8. Done. You can now log in and use your installation of Monolog Viewer

MonologViewer requires PHP 5.5 or higher. If you are using Apache, make sure to enable the mod_rewrite module.

For configuration under nginx please refer to issue #14

Configuration

The config file is a YAML file containing the paths to your log files. Log files can be grouped. These groups are called clients, but you could also see them as sites or whatever makes sense to you.

To set up log files, make sure to fill in the config file following this structure:

debug: false
timezone: "Europe/Zurich"
dateFormat: d.m.Y, H:i:s
logs:
Demo:
Demo-Log-File:
type: local
path: /path/to/your/monolog-viewer/installation/test/SyonixLogViewer/res/test.log
Acme:
Acme App:
type: ftp
host: acme.com
username: logs
password: $upersecur3
path: app/logs/prod.log

The field type determines how the app will try to access the log file. For this, Flysystem is used. Currently implemented are local and ftp, but any other Flysystem Adapter can easily be added to the Syonix\LogViewer\LogFile.php constructor. Feel free to contribute.

Note: If your config.yaml is invalid, Monolog Viewer will display an error message. Also, if a client does not contain any logs, the client will not be listed in the navigation. If your config file is invalid and you don't know why, check if there are any tab characters in it.

Configuration values

The following configuration values are available:

Name Type Description
timezone string Timezone string according to PHP Manual.
date_format string Date format for log entries according to the Angular JS Manual.
logs array List of all log files, categorized by "clients" (see above)
display_logger boolean Turn log channel (logger) display in log view on or off

Flysystem Types

local

Accesses log files on the server's local file system.

Config values Description
path The absolute file path. (You can use PHP's realpath() to get the absolute path of a file.)
ftp

Accesses log files via FTP.

Config values Description
host The host to connect to (e.g. ftp.acme.com)
username The ftp user to connect with
password The ftp user's password.
path The file path, relative to the FTP user's root directory.
port The port to use for connecting (optional, default: 21)
passive Use a passive connection (optional, default: true)
ssl Use an encrypted connection / FTP over SSL (optional, default: false)
timeout The default timeout (optional, default: 30)
sftp

Accesses log files via SFTP.

Config values Description
host The host to connect to (e.g. ftp.acme.com)
username The ftp user to connect with
password The ftp user's password.
port The port to use for connecting (optional, default: 21)
passive Use a passive connection (optional, default: true)
ssl Use an encrypted connection / FTP over SSL (optional, default: false)
timeout The default timeout (optional, default: 30)
private_key Path to the client private key (optional, no default)
All types
Config values Description
pattern A regex for a custom log line pattern.
For example if your log lines don't end in [] {} you could use /\[(?P<date>.*)\] (?P<logger>\w+).(?P<level>\w+): (?P<message>[^\[\{]+)/

Password management

My goal was to keep this tool so simple, that it can be installed on any shared hosting. Therefore I decicded not to use a database to store the password. Instead it is saved within a folder that is protected by a .htaccess file and therefore not accessible by the public.

The only way to get the password hash is via FTP and even if someone gets the file, it is still hashed using PHPs password_hash() function. If you use a secure password, this is pretty safe.

Multiple users might be implemented in the future.

Change password

To change your password, simply delete the /app/config/secure/passwd file and open Monolog Viewer to set a new password.

Mobile devices

The App is fully optimized for tablets and smart phones and can even be installed to the home screen on iOS devices. It then works like a native app and features an app icon as well as a beautiful splash screen.

Enforcing HTTPS

This should be done on a server configuration level. You could for example add this to the .htaccess file, right below RewriteEngine On:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Syonix Monolog Viewer Related Articles

Laravel 12.45.1, 12.45.2, and 12.46.0 Released image

Laravel 12.45.1, 12.45.2, and 12.46.0 Released

Read article
Fast Laravel Course Launch image

Fast Laravel Course Launch

Read article
Laravel News 2025 Recap image

Laravel News 2025 Recap

Read article
Claude Agent Now Built Into PhpStorm AI Assistant image

Claude Agent Now Built Into PhpStorm AI Assistant

Read article
Sentry Adds Logs Support for Laravel Apps image

Sentry Adds Logs Support for Laravel Apps

Read article
Singleton and Scoped Container Attributes in Laravel 12.21 image

Singleton and Scoped Container Attributes in Laravel 12.21

Read article
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
Statamic logo

Statamic

The drop-in ready Laravel CMS you’re been waiting for. Go full-stack or headless, flat file or database – it’s up to you.

Statamic
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel