From My Notepad
Jump to: navigation, search

Testing Tenshi Rules

The easiest way to test tenshi rules is to setup a separate config file used just for testing rules, and then run tenshi in foreground mode to watch what happens. Here's an example configuration file [/etc/tenshi/tenshi_testing.conf]:

set uid root
set gid root

set logfile /var/log/testing.log

set tail_multiple off
set sleep 5
set limit 800
set pager_limit 2
set mask ___
set mailserver your.relay.com
set subject testing tenshi rules
set hidepid on

set queue testing tenshi@localhost you@domain.com [* * * * *]

repeat ^(?:last message repeated|above message repeats) (\\d+) time

testing ^postfix/smtpd: (.+): client=.+[.+], sasl_method=.+, sasl_username=.+@domain.com

trash .*

Run tenshi with the following command:

echo "" > /var/log/testing.log
tenshi -c /etc/tenshi/tenshi_testing.conf -d 2 -f

This will allow you to pipe lines to test to the file /var/log/testing.log and watch how tenshi responds.