- Single File Deployment: Designed to be a single file for easy deployment.
- Log Formats Supported: Out-of-the-box support for PHP-FPM error logs, PHP slow logs, Apache 2.4 {access|error} logs, nginx {access|error} logs.
- Tail Mode: Includes an auto-refresh feature, making it perfect for real-time debugging.
- Search Box: Quickly find specific entries in your logs.
- PHP 8 Compatibility: Fully compatible with PHP 8, ensuring modern PHP features and performance.
- Maximum Log Entries: Limits the number of log lines displayed to prevent the script from being overwhelmed (default: 2000 lines).
- Password Protection: Protects the script with a password to prevent unauthorized access.
The log analyzer uses regular expressions to identify different log formats. You can easily extend support for new log types by adding patterns to the $logPatterns array.
$logPatterns = [
'php-fpm' => '/^\[\d{2}-[A-Za-z]{3}-\d{4} \d{2}:\d{2}:\d{2} [A-Z]{3}\]/',
'apache-access' => '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} - - \[\d{2}\/[A-Za-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} \+\d{4}\]/',
'apache-error' => '/^\[[A-Za-z]{3} [A-Za-z]{3} \d{2} \d{2}:\d{2}:\d{2}\.\d{6} \d{4}\] \[[a-z]+:[a-z]+\]/',
'slow-php' => '/^\[\d{2}-[A-Za-z]{3}-\d{4} \d{2}:\d{2}:\d{2}\]/'
];- Deployment: Simply upload the
sherlog.phpfile to your server. - Define Log Path: Set the path to your log files. The script will add all files with the .log extension (i.e., *.log) to the dropdown menu.
- Access: Navigate to the file in your browser.
- Authentication: Enter the configured password to access the log viewer.
- Select Log File: Use the dropdown to select the log file you wish to view.
- Tail Mode: Activate the auto-refresh mode to continuously update the log view in real-time.
- Search: Use the search box to filter log entries and quickly find relevant information.
Ensure that your log analysis capabilities remain in place even after production updates by integrating this tool into systems such as Apache's Alias directive or Nginx's location directive. You can use a specific permanent path in your directives.
To maintain log analysis capabilities in Apache, you can use the Alias directive. This ensures that the configuration remains intact even after production updates. Here's an example configuration for Apache:
Alias /sherlog.php /home/$user/permanent/sherlog.php
<Directory /home/$user/permanent>
Require all denied
Require ip YOUR.IP.YOUR.IP
</Directory>In Nginx, you can achieve similar functionality by using the location directive to restrict access to the log viewer file:
location /sherlog.php {
alias /home/$user/permanent/sherlog.php;;
allow YOUR.IP.YOUR.IP;
deny all;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; # Adjust
fastcgi_param SCRIPT_FILENAME /home/$user/permanent/sherlog.php;
}- PHP 8.0 or higher
- Web server (Apache, Nginx, etc.)
This project is licensed under the MIT License. See the LICENSE file for details.



