Code:
on *:text:!log ?*:#:{ 
  set -u %log.chan $chan
  filter -fk archive.log _msglogoutput $+(*,$remove($2,*,?,&),*)
}
alias _msglogoutput { msg %log.chan $1- }


You might want to build in some kind of flood control because there is nothing at present which would stop someone from typing "!log a" and it would read out any lines in the entire log that contain 'a'.

One thing you could do is check the length of the search term and make sure it is at least X characters long for example.