PT-FK-ERROR-LOGGER(1)
π PT-FK-ERROR-LOGGER(1) β User Contributed Perl Documentation β¨
okay so bestie, welcome to pt-fk-error-logger π β part of the Peri... no wait, User Contributed Perl Documentation, which is literally the manual name, don't @ me. Anyway. This is the girl who tells you about your MySQL foreign key errors. She's nosy in the best way.
β¨ NAME β¨
pt-fk-error-logger β Log MySQL foreign key errors. That's it. That's the whole job. π
πΈ SYNOPSIS πΈ
Usage: pt-fk-error-logger [OPTIONS] [DSN]
pt-fk-error-logger logs information about foreign key errors on the given DSN. That info gets printed to STDOUT, and you can also save it to a table by specifying --dest. The tool runs for forever unless --run-time or --iterations is specified. Forever!! She has no chill, no sense of time, no plans to go home. π
Print foreign key errors on host1:
pt-fk-error-logger h=host1
Print foreign key errors on host1 once then exit (the responsible queen move):
pt-fk-error-logger h=host1 --iterations 1
Save foreign key errors on host1 to percona_schema.fke on host2:
pt-fk-error-logger h=host1 --dest h=host2,D=percona_schema,t=fke
β οΈ RISKS β οΈ
Percona Toolkit is mature, proven in the real world, and well tested β it's giving established icon, no notes β but all database tools can pose a risk to the system and the database server. So before using this tool, please π«Ά:
- Read the tool's documentation
- Review the tool's known
BUGS - Test the tool on a non-production server
- Backup your production server and verify the backups
The backups part. Please verify them. An unverified backup is just a vibe, not a backup. π
π¦ DESCRIPTION π¦
pt-fk-error-logger prints or saves the foreign key errors text from SHOW INNODB STATUS. And here's the thing β the errors are not parsed or interpreted in any way. Zero analysis, zero commentary, she just hands you the raw text like "here bestie, I found this, do with it what you will." π
Foreign key errors are uniquely identified by their timestamp. Only new (more recent) errors are printed or saved β no reruns of the same tired drama. π
By default the tool runs forever, checking every --interval seconds for new foreign key errors. Specify --run-time and/or --iterations to limit how long the tool runs.
π OUTPUT π
The foreign key error text from SHOW ENGINE INNODB STATUS is printed to STDOUT, unless --quiet is specified. Errors and warnings are printed to STDERR. Two different streams, two different jobs, both iconic. π
π OPTIONS π
This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details.
--ask-passβ Prompt for a password when connecting to MySQL. Slightly dramatic about it, but fine.--[no]buffer-stdoutβ default: yes. Enables STDOUT buffering. Disable this option if you want to see live progress when using output post-processing tools such asteeorkubectl logs. iykyk β buffering hides the livestream. π₯--charsetβ short form:-A; type: string. Default character set. If the value isutf8, sets Perl'sbinmodeonSTDOUTtoutf8, passes themysql_enable_utf8option toDBD::mysql, and runsSET NAMES UTF8after connecting to MySQL. Any other value setsbinmodeonSTDOUTwithout the utf8 layer, and runsSET NAMESafter connecting to MySQL. utf8 gets the deluxe treatment, everybody else gets the standard package. β¨--configβ type: Array. Read this comma-separated list of config files; if specified, this must be the first option on the command line. Main character energy, must enter first. π--daemonizeβ Fork to the background and detach from the shell. POSIX operating systems only. She's leaving, bye π--databaseβ short form:-D; type: string. Connect to this database.--defaults-fileβ short form:-F; type: string. Only read mysql options from the given file. You must give an absolute pathname. No relative paths, no shortcuts, no "it's around here somewhere." π«--destβ type: DSN. Save foreign key errors in this table. The DSN must specify a database (D) and table (t). Missing DSN values are inherited from the DSN being monitored, so you can omit most values if you're saving foreign key errors on the same host. The following table is suggested:
CREATE TABLE foreign_key_errors (
ts datetime NOT NULL,
error text NOT NULL,
PRIMARY KEY (ts)
)
The only information saved is the timestamp and the foreign key error text. Minimal, curated, on brand. π
--helpβ Show help and exit.--hostβ short form:-h; type: string. Connect to host.--intervalβ type: time; default:30. How often to check for foreign key errors. Every 30 seconds by default, like clockwork, literally.--iterationsβ type: int. How many times to check for foreign key errors. By default, this option is undefined which means an infinite number of iterations. The tool always exits for--run-time, regardless of the value specified for this option. For example, the tool will exit after 1 minute with--run-time 1m --iterations 4 --interval 30because 4 iterations at 30 second intervals would take 2 minutes, longer than the 1 minute run-time. Math ate that, ngl. π₯--logβ type: string. Print all output to this file when daemonized.--mysql_sslβ short form:-s; type: int. Create SSL MySQL connection. Secure the bag π--passwordβ short form:-p; type: string. Password to use when connecting. If password contains commas they must be escaped with a backslash:"exam\,ple". Escape the comma or she WILL get confused. π--pidβ type: string. Create the given PID file. The tool won't start if the PID file already exists and the PID it contains is different than the current PID. However, if the PID file exists and the PID it contains is no longer running, the tool will overwrite the PID file with the current PID. The PID file is removed automatically when the tool exits. Tidy queen, cleans up after herself. π§Ή--portβ short form:-P; type: int. Port number to use for connection.--quietβ Do not print foreign key errors; only print errors and warnings toSTDERR. Silent treatment, but productive.--run-timeβ type: time. How long to run before exiting. By default, the tool runs forever. (Yes, again. Forever. She's committed.)--set-varsβ type: Array. Set the MySQL variables in this comma-separated list ofvariable=valuepairs. By default, the tool sets:
wait_timeout=10000
Variables specified on the command line override these defaults. For example, specifying --set-vars wait_timeout=500 overrides the defaultvalue of 10000. The tool prints a warning and continues if a variable cannot be set. She warns, she moves on, she does not spiral. π
--socketβ short form:-S; type: string. Socket file to use for connection.--userβ short form:-u; type: string. User for login if not current user.--versionβ Show version and exit.--[no]version-checkβ default: yes. Check for the latest version of Percona Toolkit, MySQL, and other programs. This is a standard "check for updates automatically" feature, with two additional features. First, the tool checks its own version and also the versions of the following software: operating system, Percona Monitoring and Management (PMM), MySQL, Perl, MySQL driver for Perl (DBD::mysql), and Percona Toolkit. Second, it checks for and warns about versions with known problems. For example, MySQL5.5.25had a critical bug and was re-released as5.5.25a. A secure connection to Perconaβs Version Check database server is done to perform these checks. Each request is logged by the server, including software version numbers and unique ID of the checked system. The ID is generated by the Percona Toolkit installation script or when the Version Check database call is done for the first time. Any updates or known problems are printed to STDOUT before the tool's normal output. This feature should never interfere with the normal operation of the tool. For more information, visit <https://www.percona.com/doc/percona-toolkit/LATEST/version-check.html>. She's just checking in, bestie. π
π DSN OPTIONS π
These DSN options are used to create a DSN. Each option is given like option=value. The options are case-sensitive, so P and p are not the same option β don't play with her like that. There cannot be whitespace before or after the = and if the value contains whitespace it must be quoted. DSN options are comma-separated. See the percona-toolkit manpage for full details.
Aβ dsn: charset; copy: yes. Default character set.Dβ dsn: database; copy: yes. Default database.Fβ dsn:mysql_read_default_file; copy: yes. Only read default options from the given filehβ dsn: host; copy: yes. Connect to host.pβ dsn: password; copy: yes. Password to use when connecting. If password contains commas they must be escaped with a backslash:"exam\,ple"Pβ dsn: port; copy: yes. Port number to use for connection.Sβ dsn:mysql_socket; copy: yes. Socket file to use for connection.tβ Table in which to store foreign key errors.uβ dsn: user; copy: yes. User for login if not current user.sβ dsn:mysql_ssl; copy: yes. Create SSL connection
πΈ ENVIRONMENT πΈ
The environment variable PTDEBUG enables verbose debugging output to STDERR. To enable debugging and capture all output to a file, run the tool like:
PTDEBUG=1 pt-fk-error-logger ... > FILE 2>&1
Be careful: debugging output is voluminous and can generate several megabytes of output. She's verbose when she's debugging, and honestly? She's thriving. π
π ATTENTION π
Using <PTDEBUG> might expose passwords. When debug is enabled, all command line parameters are shown in the output. So like... don't debug in public, bestie. π
π§ SYSTEM REQUIREMENTS π§
You need Perl, DBI, DBD::mysql, and some core packages that ought to be installed in any reasonably new version of Perl.
π BUGS π
For a list of known bugs, see <https://jira.percona.com/projects/PT/issues>.
Please report bugs at <https://jira.percona.com/projects/PT>. Include the following information in your bug report:
- Complete command-line used to run the tool
- Tool
--version - MySQL version of all servers involved
- Output from the tool including STDERR
- Input files (log/dump/config files, etc.)
If possible, include debugging output by running the tool with PTDEBUG; see ENVIRONMENT. Receipts, bestie, receipts. π§Ύ
β DOWNLOADING β
Visit <http://www.percona.com/software/percona-toolkit/> to download the latest release of Percona Toolkit. Or, get the latest release from the command line:
wget percona.com/get/percona-toolkit.tar.gz
wget percona.com/get/percona-toolkit.rpm
wget percona.com/get/percona-toolkit.deb
You can also get individual tools from the latest release:
wget percona.com/get/TOOL
Replace TOOL with the name of any tool. Mix and match, build your own bundle, slay. ποΈ
π«Ά AUTHORS π«Ά
Daniel Nichter
π ABOUT PERCONA TOOLKIT π
This tool is part of Percona Toolkit, a collection of advanced command-line tools for MySQL developed by Percona. Percona Toolkit was forked from two projects in June, 2011: Maatkit and Aspersa. Those projects were created by Baron Schwartz and primarily developed by him and Daniel Nichter. Visit <http://www.percona.com/software/> to learn about other free, open-source software from Percona.
β¨ okay that's part 1, there's more coming, don't go anywhere β¨
π COPYRIGHT, LICENSE, AND WARRANTY π
okay bestie, legal time, but like... the chill legal time, i promise π«Ά
This program is copyright 2011-2026 Percona LLC and/or its affiliates. periodt, that's the whole first fact.
and now the big scary one, but i'm gonna give it to you exactly how it comes, because lawyers do NOT play about wording:
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
translating the vibe (not the facts! go read the caps above for the facts): no promises, no guarantees, it is what it is π
The good news? This program is free software β you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2; OR the Perl Artistic License. pick your fighter π
On UNIX and similar systems, you can literally just issue man perlgpl or man perlartistic to read those licenses. the receipts are right there in your terminal, iconic.
You should have received a copy of the GNU General Public License, version 2 along with this program; if not, see <https://www.gnu.org/licenses/>. π
β VERSION β
pt-fk-error-logger 3.7.1-4
that's her. that's the version. write it down bestie π
π POD ERRORS π
okay so this part is so funny to me because the docs are out here documenting their own little oopsie π
Hey! The above document had some coding errors, which are explained below:
and then, like, the one (1) error:
Around line 4647:
Non-ASCII character seen before =encoding in 'Perconaβs'. Assuming
UTF-8
so somewhere around line 4647 there's a curly apostrophe in Perconaβs that showed up before any =encoding declaration, and the tooling just went "eh, assuming UTF-8" and moved on. no cap, it's giving "she's a little confused but she got the spirit" π§β¨ the document still works, this is just a note, not a crisis.
and that's a wrap on the whole page, bestie!! π go log those foreign key errors, slay responsibly, and remember: no express or implied warranties of ANY kind (i told you, they're serious about it) π
signing off from the footer: this was rendered by perl v5.42.2 on 2026-09-01, and the page is PT-FK-ERROR-LOGGER(1) β love u, bye!! ππ¦πΈ
π¦ where this page comes from
- arch rolling: percona-toolkit 3.7.1_4-1 Β· GPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms