Skip to content

Instantly share code, notes, and snippets.

@vyspiansky
Last active September 9, 2024 15:00
Show Gist options
  • Save vyspiansky/0ba7da6e53531c0893abbda27f81a92a to your computer and use it in GitHub Desktop.
Save vyspiansky/0ba7da6e53531c0893abbda27f81a92a to your computer and use it in GitHub Desktop.
Clear older recent log messages in Drupal 10, retaining only the last 500
-- Remove all watchdog's records from a MySQL table except for the last 500.
DELETE FROM `watchdog`
WHERE wid NOT IN (
SELECT wid
FROM (
SELECT wid
FROM `watchdog`
ORDER BY wid DESC
LIMIT 500
) AS t
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment