Score:3

Selective cancellation from Watchdog

iq flag

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.

id flag
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.
Francesco Marchetti-Stasi avatar
iq flag
@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.
Score:1
cn flag

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.

Francesco Marchetti-Stasi avatar
iq flag
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 ;-) )
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.