* docs: [1.2.x] document features the manual did not cover Add pages for the user profile settings and for the SNMP Agent and its notification receivers, and link them from the front page. Add sections on realtime graphs and CSV export to Viewing-Graphs, on the data source statistics collection process to Settings-Data, and on upgrading from 0.8.x to Upgrading-Cacti. Extend the RRDfile Cleaner, RRDfile Checker and user log descriptions in System-Utilities, document cli/add_datasource.php, and replace the Users, Groups and Domains stub with an overview. Labels, defaults, menu paths and options are taken from the Cacti 1.2.x source at 1523aa04b. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] add a manual page for every supported plugin (#282) * docs: [1.2.x] add a manual page for every supported plugin Add pages for Thold, Monitor, Maintenance, Intropage, Host MIB, APC UPS, Evidence, FlowView, MikroTik, ReportIt, Router Configs, Service Check, Slowlog, Weathermap and WMI, each with the same sections: requirements, installation, permissions, settings, use, background processing, command-line tools and troubleshooting. Bring the Syslog and MacTrack pages to the same structure and add screenshots to MacTrack. Each page documents the plugin's latest published release for Cacti 1.2.x and states that version; WMI has no release and follows its development branch. Link the pages from the front page and the plugin catalog, and correct the catalog's APC UPS and Router Configs descriptions to match those releases. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] update front-page developer credits and GitHub profile links Align the Active Developers, Contributors, Emeritus Members and In Memoriam entries in README.md with Cacti 1.2.x about.php (Cacti/cacti 3c4b7fde0): move Sean Mancini to Active Developers, Thomas Urban to Contributors, and Chris Bell and Jing Chen to Emeritus Members. Link each named developer and contributor to their verified GitHub profile. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
6.0 KiB
MySQL/MariaDB Slow Log Viewer
The Slowlog plugin imports a MySQL or MariaDB slow query log into the Cacti database and summarizes it by query method and by table, with charts and a searchable list of individual queries. Cacti administrators and database administrators use it to find which statements and tables account for slow queries, whether the log comes from the Cacti database or from another database server.
Requirements
-
This page documents Slowlog 2.1 (release tag
v2.1). -
Cacti 1.2.23 or later (INFO
compat). -
No other plugin is required.
-
The installer creates the
plugin_slowlog_details,plugin_slowlog_details_methodsandplugin_slowlog_details_tablestables with the Aria storage engine, which MariaDB provides. -
The web server's PHP
upload_max_filesizeandpost_max_sizelimits must be larger than the log files you upload. The import page shows the current values.
Installation
Install the plugin as described in Plugin Management. The
plugin needs no configuration file. Installing it creates the
plugin_slowlog tables and loads the query methods and the reserved word
list from keywords.txt. Uninstalling it drops all plugin_slowlog tables
and the imported logs with them.
Permissions
The plugin registers one realm. Users without it do not see the SlowLog tab.
Table 1. Slowlog realm
| Realm | Pages |
|---|---|
| Plugin -> MySQL Slow Log Viewer | slowlog.php |
Settings
The plugin adds no settings to Console > Configuration > Settings. The options that control an import are on the import form described below.
Using Slowlog
Click the SlowLog tab. The page has up to five tabs: Summary, By Method, By Table, Details and, when a single query is open, Query. Only Summary is shown until a log is selected.
Importing a slow log
-
On the Summary tab, click the add icon in the MariaDB/MySQL SlowLog File Filters box.
-
Under Import Template from Local File, choose the slow log file.
-
Enter a LogFile Description. The default is
New Slow Log. -
Choose Max Query Length: All, or the first 1024 to 16384 characters of each query.
-
To get per-table statistics, either check Use This Cacti Database if the log comes from this Cacti server's database, or paste a space-delimited list of table names into Tables of Interest. Leave both empty to let post-processing detect the tables from the queries.
-
Click Import.
The file is read in the web request and its entries are stored. Post processing, which assigns each query to a method and to tables, continues in the background. The Summary list shows the Import Status as Pre-Processing, Post-Processing or Complete together with the Status String, the number of Lines, and the log's Start Date, End Date and Duration. Start analyzing the details once the status is Complete.
By Method and By Table
Each log on the Summary list has three icons: View Methods, View Tables and View Details. They open the By Method, By Table and Details tabs for that log. By Method and By Table each draws six charts: the number of queries, total query time, rows examined, rows sent, rows affected and bytes sent, grouped by method or by table. The methods are SELECTS, DISTINCTS, JOINS, UNIONS, INSERTS, REPLACES, UPDATES, DELETES, RENAMES, FLUSHES, TRUNCATES, LOAD DATA, OUTFILES and OTHERS.
Details and Query
The Details tab lists the log entries with Table Name, Method, Date, User, Host, Query Time, Lock Time, Sent, Examined, Affected and Bytes Sent. Filter it by LogFile, Method, Tables, User, Host, a search string and a From / To time range. In Tables, Others shows entries that matched no table, and N/A lists the entries without splitting them by table. Click an entry to open the Query tab, which shows the entry's statistics and the Original Query.
Deleting a log
On the Summary tab, select one or more logs, choose Delete from the actions list and click Go.
Background Processing
The plugin has no poller hook. Each web import starts import_log.php in the
background with the new log's ID to finish post-processing. Table statistics
are written to plugin_slowlog_tables and plugin_slowlog_details_tables,
and STATS: lines with the SLOWLOG prefix are written to the Cacti log
when the method and table passes finish. Imported data stays in the database
until you delete the log.
Command-Line Tools
import_log.php imports a log file from the server without the upload size
limits, or reruns post-processing for an existing log. Run it from the plugin
directory:
cd plugins/slowlog
php import_log.php --logfile=/path/to/slow.log [--usecacti]
php import_log.php --logid=N [--usecacti]
-
--logfile=Simports the file and post-processes it in the same run. -
--logid=Nruns post-processing for a log that has already been imported. -
--usecactiuses the tables of the current Cacti database as the tables of interest. -
--versionand--helpprint the version or usage.
Troubleshooting
-
A file larger than Max Upload Filesize or Max Post Size on the import form cannot be uploaded. Raise
upload_max_filesizeandpost_max_sizein the web server'sphp.iniand restart the web server, or import the file withimport_log.php --logfile. -
FATAL: Can not find filefromimport_log.phpmeans the path given to--logfiledoes not exist. -
An import only starts storing entries after the first
# Time:line of the log.
More Information
-
README for release 2.1: README.md
Copyright (c) 2004-2026 The Cacti Group