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 as tee or kubectl logs. iykyk β€” buffering hides the livestream. πŸ”₯
  • --charset β€” short form: -A; type: string. Default character set. If the value is utf8, sets Perl's binmode on STDOUT to utf8, passes the mysql_enable_utf8 option to DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL. Any other value sets binmode on STDOUT without the utf8 layer, and runs SET NAMES after 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 30 because 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 to STDERR. 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 of variable=value pairs. 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, MySQL 5.5.25 had a critical bug and was re-released as 5.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 file
  • h β€” 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 ✨

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