A viewer to nicely display log files generated by Monolog.
- Download Composer
- Execute
php composer.phar create-project syonix/monolog-viewer install-directory/
(make sure to replaceinstall-directory
with the name of the directory you want to install monolg viewer into. - Upload the files to your webspace
- 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. - Create a configuration file (rename or copy the
config_example.json
). - Open Monolog Viewer in the browser
- Enter a password of your choice twice and click "Create login".
- Done. You can now log in and use your installation of Monolog Viewer
The config file is a Json 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" : "UTC",
"clients" : [
{
"name": "Your first client",
"logs": {
"Error-Log":"http://acme.com/logs/error.log",
"Info-Log":"http://acme.com/logs/info.log"
}
},
{
"name": "Your second client",
"logs": {
"Sent Mails":"http://acme-forum.com/logs/mail.log"
}
}
]
}
Note: If your config.json
is invalid or none of your log files are readable, Monolog Viewer will display an error message. Also, if a client contains only logs that are not readable, the client will not be listed in the navigation.
The following configuration values are available:
Name | Type | Description |
---|---|---|
timezone |
string |
Timezone string according to PHP Manual. |
dateFormat |
string |
Date format for log entries according to PHP Manual. |
clients |
array |
List of all log files, categorized by "clients" (see above) |
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.
To change your password, simply delete the /app/config/secure/passwd
file and open Monolog Viewer to set a new password.
The App is fully optimized for tablets and can be installed to the home screen on the iPad. It then works like a native app and features an app icon as well as a beautiful splash screen.
A smartphone optimized version is planned for the future.