Pimp My Log is a web application for viewing and analyzing web server and application logs. It supports Apache, Nginx, PHP, MySQL, and other log types with a convenient web interface.
- π Real-time log viewing with automatic refresh
- π Powerful search with regular expression support
- π¨ User-friendly web interface with filtering and sorting
- π Authentication and user management system
- π± Responsive design for mobile devices
- π€ Export logs in various formats (CSV, JSON, XML, RSS, ATOM)
- π§© Block-based parsing support for multi-line logs (MySQL Slow Log, etc.)
- π Multi-language support
- βοΈ Flexible configuration via JSON/PHP configuration files
- PHP >= 5.2.0 (PHP 8.0+ recommended)
- Web server (Apache, Nginx, IIS)
- PHP extensions:
json,mbstring(optional)
git clone https://github.com/350d/PimpMyLog.git
cd PimpMyLogTo update to the latest version, pull the latest changes from the repository:
cd PimpMyLog
git pull origin masterIf you have local modifications, you may need to stash them first:
git stash
git pull origin master
git stash pop-
Copy the configuration file:
cp cfg/config.example.php config.user.php
-
Open the web interface:
- Open
http://your-domain.com/path-to-pimpmylog/in your browser - Follow the setup wizard instructions
- Open
-
Configure log access:
- Specify paths to your log files in the configuration
- Configure regular expressions for parsing (examples included)
- Set up authentication if needed
{
"files": {
"apache_error": {
"display": "Apache Error",
"path": "/var/log/apache2/error.log",
"refresh": 5,
"max": 50,
"format": {
"regex": "|^\\[(.*)\\] \\[(.*)\\] (\\[client (.*)\\] )*((?!\\[client ).*)(, referer: (.*))*$|U",
"match": {
"Date": 1,
"Severity": 2,
"IP": 4,
"Log": 5,
"Referer": 7
}
}
}
}
}{
"files": {
"php_error": {
"display": "PHP Error Log",
"path": "/srv/users/serverpilot/apps/YOURAPP/log/YOURAPP_php8.5.error.log",
"refresh": 5,
"max": 100,
"format": {
"regex": "|^\\[(.*)\\] PHP (.*): (.*) in (.*) on line (.*)$|",
"match": {
"Date": 1,
"Severity": 2,
"Message": 3,
"File": 4,
"Line": 5
}
}
}
}
}Setup Instructions:
-
Create log directory and set permissions:
sudo mkdir -p /srv/users/serverpilot/apps/YOURAPP/log sudo chown mysql:mysql /srv/users/serverpilot/apps/YOURAPP/log sudo chmod 755 /srv/users/serverpilot/apps/YOURAPP/log sudo -u mysql touch /srv/users/serverpilot/apps/YOURAPP/log/mysql-slow.log
-
Add path to AppArmor profile (if AppArmor is enabled):
sudo nano /etc/apparmor.d/usr.sbin.mysqld # Add these lines in the log section: # /srv/users/serverpilot/apps/YOURAPP/log/ r, # /srv/users/serverpilot/apps/YOURAPP/log/** rw, sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
-
Configure MySQL:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf # Add or update: # slow_query_log = 1 # slow_query_log_file = /srv/users/serverpilot/apps/YOURAPP/log/mysql-slow.log # long_query_time = 2 sudo service mysql restart
-
Enable slow query log:
mysql -e "SET GLOBAL slow_query_log = 'ON';" mysql -e "SHOW VARIABLES LIKE 'slow_query%';"
Configuration Example:
{
"files": {
"mysqlslow": {
"display": "MySQL Slow Log",
"path": "/srv/users/serverpilot/apps/YOURAPP/log/mysql-slow.log",
"refresh": 60,
"max": 200,
"format": {
"block_start": "# Time:",
"regex": "/# Time: ([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\\.[0-9]+Z.*?# Query_time: ([0-9.]+)\\s+Lock_time: ([0-9.]+).*?Rows_examined: ([0-9]+)\\n([\\s\\S]*?)(?=# Time:|\\z)/s",
"match": {
"Date": {
"Y": 1,
"m": 2,
"d": 3,
"H": 4,
"i": 5,
"s": 6
},
"Time": 7,
"Lock": 8,
"Rows": 9,
"SQL": 10
}
}
}
}
}If your site is hosted on ServerPilot, logs are typically located in the following places:
| Log Type | Path |
|---|---|
| PHP Error Log | /srv/users/serverpilot/apps/YOURAPP/log/YOURAPP_php8.5.error.log |
| PHP Access Log | /srv/users/serverpilot/apps/YOURAPP/log/YOURAPP_php8.5.access.log |
| Apache Error Log | /srv/users/serverpilot/apps/YOURAPP/log/YOURAPP_apache.error.log |
| Apache Access Log | /srv/users/serverpilot/apps/YOURAPP/log/YOURAPP_apache.access.log |
| PHP-FPM Service Log | /var/log/php8.5-fpm-sp.log |
Note: Replace YOURAPP with your application name in ServerPilot. PHP version may vary (php7.4, php8.0, php8.1, php8.2, php8.3, php8.5, etc.).
{
"files": {
"serverpilot_php_error": {
"display": "PHP Error (ServerPilot)",
"path": "/srv/users/serverpilot/apps/myapp/log/myapp_php8.5.error.log",
"refresh": 5,
"max": 100,
"notify": true,
"format": {
"regex": "|^\\[(.*)\\] PHP (.*): (.*) in (.*) on line (.*)$|",
"match": {
"Date": 1,
"Severity": 2,
"Message": 3,
"File": 4,
"Line": 5
},
"types": {
"Date": "date:H:i:s",
"Severity": "badge:severity",
"Message": "pre",
"File": "txt",
"Line": "numeral"
}
}
},
"serverpilot_php_access": {
"display": "PHP Access (ServerPilot)",
"path": "/srv/users/serverpilot/apps/myapp/log/myapp_php8.5.access.log",
"refresh": 0,
"max": 50,
"format": {
"regex": "|^(.*) - \\[(.*)\\] \"(.*) (.*) (.*)\" ([0-9]*) (.*) - (.*) (.*) (.*) \"(.*)\" \"(.*)\"|",
"match": {
"IP": 1,
"Date": 2,
"Method": 3,
"URL": 4,
"Protocol": 5,
"Code": 6,
"Size": 7,
"Referer": 11,
"UA": 12
},
"types": {
"Date": "date:H:i:s",
"IP": "ip:geo",
"Code": "badge:http",
"Size": "numeral:0b"
}
}
}
}
}PimpMyLog/
βββ cfg/ # Configuration files and examples
βββ css/ # Stylesheets
βββ fonts/ # Fonts
βββ img/ # Images and icons
βββ inc/ # PHP libraries and classes
β βββ classes/ # Core classes (LogParser, Sentinel, Session)
β βββ ...
βββ js/ # JavaScript files
βββ lang/ # Localization files
βββ tmp/ # Temporary files
βββ index.php # Main entry point
βββ config.user.json # Your configuration file (created during setup)
βββ README.md # This file
- Set proper file permissions for configuration files
- Use authentication to protect log access
- Restrict directory access via web server (
.htaccessfor Apache) - Do not place configuration files in public directories
GPL-3.0+
- Issues: GitHub Issues
- Fork: Based on potsky/PimpMyLog
- β Block-based parsing support for multi-line logs (MySQL Slow Log)
- β PHP 8.0+ compatibility
- β Improved configuration parsing error handling
- β ServerPilot configuration examples