Une commande pouvant être utilisée pour envoyer un mail lors de la détection est:

$ tail -f /var/log/messages | awk ' /toto/ { system("echo toto | mail -s pouet toto@aaa.tld") }'

Pour déclencher lors d’un test on peut utiliser:

$ logger -t TEST totofgdfsdfsdf

Extraits des man:

man awk
The pattern comes first, and then the action. Action statements are enclosed in { and }.
For /regular expression/ patterns, the associated statement is executed for each input record that matches the regular expression.
system(cmd-line) Execute the command cmd-line, and return the exit status.
EXAMPLES
Run an external command for particular lines of data:
tail -f access_log | awk ‘/myhome.html/ { system(“nmap " $1 “» logdir/myhome.html”) }’

man system
system - Exécuter une commande shell
La fonction system() exécute la commande indiquée dans commande en appelant /bin/sh -c commande…