2017 © Pedro Peláez
 

project monolog-viewer

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

image

syonix/monolog-viewer

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

  • Friday, July 1, 2016
  • by syonix
  • Repository
  • 12 Watchers
  • 231 Stars
  • 4,395 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 50 Forks
  • 24 Open issues
  • 12 Versions
  • 2 % Grown

The README.md

Monolog Viewer

Build Status Total Downloads Latest Stable Version SensioLabsInsight, (*1)

A viewer to nicely display log files generated by Monolog., (*2)

Screenshot Mockup Credits, (*3)

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., (*4)

For configuration under nginx please refer to issue #14, (*5)

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., (*6)

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

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., (*8)

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., (*9)

Configuration values

The following configuration values are available:, (*10)

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., (*11)

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., (*12)

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., (*13)

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., (*14)

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., (*15)

Multiple users might be implemented in the future., (*16)

Change password

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

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., (*18)

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:, (*19)

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

The Versions

22/08 2014

2.0.0

2.0.0.0 https://github.com/Syonix/monolog-viewer

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

  Sources   Download

GPL-2.0

The Requires

 

log logging monolog viewer

04/06 2014

1.1.3

1.1.3.0 https://github.com/Syonix/monolog-viewer

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

  Sources   Download

GPL-2.0

The Requires

 

log logging monolog viewer

04/01 2014

1.1.1

1.1.1.0 https://github.com/Syonix/monolog-viewer

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

  Sources   Download

GPL-2.0

The Requires

 

log logging monolog viewer

04/01 2014

1.0.0

1.0.0.0 https://github.com/Syonix/monolog-viewer

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

  Sources   Download

GPL-2.0

log logging monolog viewer