3

Can I selectively DELETE rows from watchdog? I have annoying errors and warnings I'm slowly getting rid of, but I would like to keep the history of user actions (create, update and delete on content).

I made an experiment on my development environment and I had no problem, I also found somebody around who did something similar and survived – but still, I'd like to be sure that this is legit.

2
  • 1
    Drupal 8 reached end of life in November 2021. I see so many new Drupal 8 questions here that I am concerned that people do not know that Drupal 8 contains security bugs which are publicly known.
    – cilefen
    May 23, 2022 at 10:06
  • @cilefen, thank you, I know, but we cannot migrate yet because we have a complex custom module that will take some time to adapt – but it's on an internal server without Internet access, so we feel safe enough. We plan to upgrade as soon as we finish a couple of important new features. May 31, 2022 at 7:18

1 Answer 1

1

You can do this with Drush and it's super easy:

Delete a specific message containing a string:

drush watchdog:delete "a string I want to delete"

Delete all php category messages:

drush watchdog:delete --type=php

Full documentation

It is totally safe to delete watchdog messages like this-- core automatically prunes messages when you get too many, anyway. The only "danger" is that you may delete information you need to debug issues with your site, but as long as you check the messages before deleting them, it shouldn't be a problem.

1
  • Oh, many thanks, I didn't notice that, and it feels certainly much safer than operating at the SQL level (I guess it will do the same, but it will feel safer anyway ;-) ) May 31, 2022 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.