Skip to content

Instantly share code, notes, and snippets.

@iAugur
Last active May 5, 2016 12:31
Show Gist options
  • Save iAugur/4435596 to your computer and use it in GitHub Desktop.
Save iAugur/4435596 to your computer and use it in GitHub Desktop.
Analysing your Drupal Watchdog for Spammers
/**
* Get a list of Mollom entries from the Drupal Watchdog
* summarised by IP address
*/
SELECT hostname, count(wid)
FROM `watchdog`
where type = 'mollom' and message like 'Spam%'
group by hostname
order by count(wid) desc
/**
* Get a summary of Mollom spam events for a given IP by day from the Drupal Watchdog
*/
select FROM_UNIXTIME(timestamp, '%Y %M %d'), count(*)
from `watchdog`
where hostname = '<put an IP in here>'
group by FROM_UNIXTIME(timestamp, '%Y %M %d')
order by FROM_UNIXTIME(timestamp, '%Y %M %d')
/**
* Get a summary of Mollom spam events by day from the Drupal Watchdog
*/
select DATE_FORMAT(FROM_UNIXTIME(timestamp) , '%Y-%m-%d') as day, count(*)
from `watchdog`
where message like 'Spam%'
group by DATE_FORMAT(FROM_UNIXTIME(timestamp) , '%Y-%m-%d')
order by DATE_FORMAT(FROM_UNIXTIME(timestamp) , '%Y-%m-%d')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment