[rt-users] Duplicate ticket detection at OnCreate

Vegard Vesterheim vegard.vesterheim at uninett.no
Fri Jan 23 02:52:16 EST 2015

On Thu, 22 Jan 2015 16:48:13 -0500 Kevin Falcone <falcone at bestpractical.com> wrote:

> Heck, you could filter at the mail level using bin/rt to search for
> tickets and blackhole mail from getting to RT if you find tickets with
> the same subject.

Yes, we do exactly that for a similar case, it works nicely. 

We use procmail to pipe the mail message through a script that calls
bin/rt looking for existing ticket with similar subjects. In our case
we want to merge the new message into the existing ticket, so we simply
alter the Subject header adding the RT ticket number, something like this:

my $rt_cli = '/usr/local/bin/rt';
my $timeout_cmd = '/usr/bin/timeout';

my $ticket_response = `$timeout_cmd 5 $rt_cli ls -i -t ticket "Subject like whatever-you-like"`;
if (my ($ticket) = $ticket_response =~ m!^ticket/(\d+)\s*!) {
      printf STDERR "Found existing RT-ticket $ticket\n" if $debug;
      $in_subject .= " [example.org #${ticket}]";

You could, of course ,skip the message altogether.

 - Vegard V -

More information about the rt-users mailing list