Laravel Telescope: Data too long for column ‘content’

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, November 04, 2018

Follow me on Twitter as @mattiasgeniar

For Oh Dear!, we’re using Laravel Telescope as a convenient way of tracking/displaying exceptions, runs, …

It stores its exceptions in the database, so you can easily view them again. It stores those in a TEXT field in MySQL, which is limited to 2^16 bytes, or 65536 bytes. Some of our exceptions tend to be pretty long, and they were hitting this limit.

The fix is to transfer the column from a TEXT to a LONGTEXT instead.

MariaDB [ohdear]> ALTER TABLE telescope_entries MODIFY content LONGTEXT;

You now have 2^32 bytes for storing data, or 4MB.

The table will now show it has a LONGTEXT field instead.

MariaDB [ohdear]> describe telescope_entries;
+-------------------------+---------------------+------+-----+---------+----------------+
| Field                   | Type                | Null | Key | Default | Extra          |
+-------------------------+---------------------+------+-----+---------+----------------+
| sequence                | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| uuid                    | char(36)            | NO   | UNI | NULL    |                |
| batch_id                | char(36)            | NO   | MUL | NULL    |                |
| family_hash             | varchar(191)        | YES  | MUL | NULL    |                |
| should_display_on_index | tinyint(1)          | NO   |     | 1       |                |
| type                    | varchar(20)         | NO   | MUL | NULL    |                |
| content                 | longtext            | YES  |     | NULL    |                |
| created_at              | datetime            | YES  |     | NULL    |                |
+-------------------------+---------------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)

Your exceptions/stacktraces should now be logged properly.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.