Laravel Telescope: Data too long for column ‘content’

Mattias Geniar, Sunday, November 4, 2018

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.



Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *