On Fri, Jul 9, 2010 at 2:45 PM, Kenneth Crocker <kfcroc...@lbl.gov> wrote:
> Asif,
>
> Sometimes, depending on the message, the number refers to the script being
> acted on or a user ID or a QueueID, etc. That's about all I know.

I applied the attached patch on /opt/rt3/lib/RT/Action/SendEmail.pm

and now info log generated by SendEmail.pm on rt.log shows like this

<rt-3.8.2-485-1279306601-1713.769653-174-0-4525...@rt.example.net>

The last number is now transaction id.

On SendEmail.pm $self->TransactionObj->id has the transaction id

I like to make similar change to /opt/rt3/lib/RT/Interface/Email.pm.
What value carries the transaction id on this module?
$self->TransactionObj->id does not seem to carry that.

I read the perldoc Email.pm and could not fig out from there either.

Please help

>
> Kenn
> LBNL
>
> On Fri, Jul 9, 2010 at 10:52 AM, Asif Iqbal <vad...@gmail.com> wrote:
>>
>> Hi All
>>
>> I noticed about 60% of all rt.log has a token in the following format
>>
>> &nbsp;<rt-3.8.2-16815-1278696300-880.767036-18...@rt.example.net>
>>
>> and some of those are followed by the ticket number, transaction
>> number and Scrip number after that
>> like this
>>
>> &nbsp;<rt-3.8.2-16075-1278695671-112.767031-17...@rt.example.net>
>> #767031/4506465 - Scrip 174 ...
>>
>> Is there a to find out what are those numbers mean?
>>
>> Obviously..
>> &nbsp; 767031 in that <..token> is the ticket number.
>> &nbsp; rt-3.8.2 is the RT version
>> &nbsp; 1278695671 is probably the epoch time
>>
>> But, what are the other numbers represents ?
>>
>> --
>> Asif Iqbal
>> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
>> A: Because it messes up the order in which people normally read text.
>> Q: Why is top-posting such a bad thing?
>>
>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>> Buy a copy at http://rtbook.bestpractical.com
>
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>



--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
--- SendEmail.pm.orig	2010-07-16 11:43:00.000000000 -0400
+++ SendEmail.pm	2010-07-16 14:26:01.652080145 -0400
@@ -295,10 +295,13 @@
 
     my $msgid = $MIMEObj->head->get('Message-ID');
     chomp $msgid;
+    my $txid = $self->TransactionObj->id;
+    my $msgidwithtxid = $msgid;
+    $msgidwithtxid =~  s/\@/-${txid}@/;
 
     $self->ScripActionObj->{_Message_ID}++;
 
-    $RT::Logger->info( $msgid . " #"
+    $RT::Logger->info( $msgidwithtxid . " #"
             . $self->TicketObj->id . "/"
             . $self->TransactionObj->id
             . " - Scrip "
@@ -315,6 +318,7 @@
     return $status unless ($status > 0 || exists $self->{'Deferred'});
 
     my $success = $msgid . " sent ";
+    my $successwithtxid = $msgidwithtxid . " sent ";
     foreach (@EMAIL_RECIPIENT_HEADERS) {
         my $recipients = $MIMEObj->head->get($_);
         $success .= " $_: " . $recipients if $recipients;
@@ -329,7 +333,7 @@
 
     $success =~ s/\n//g;
 
-    $RT::Logger->info($success);
+    $RT::Logger->info($successwithtxid);
 
     return (1);
 }
@@ -543,6 +547,9 @@
 
     my $msgid = $MIMEObj->head->get('Message-ID');
     chomp $msgid;
+    my $txid = $self->TransactionObj->id;
+    my $msgidwithtxid = $msgid;
+    $msgidwithtxid =~  s/\@/-${txid}@/;
 
     my ( $id, $msg ) = $transaction->Create(
         Ticket         => $self->TicketObj->Id,
@@ -763,6 +770,10 @@
     # If the transaction has content and has the header RT-Squelch-Replies-To
 
     my $msgid = $self->TemplateObj->MIMEObj->head->get('Message-Id');
+    my $txid = $self->TransactionObj->id;
+    my $msgidwithtxid = $msgid;
+    $msgidwithtxid =~  s/\@/-${txid}@/;
+
     if ( my $attachment = $self->TransactionObj->Attachments->First ) {
 
         if ( $attachment->GetHeader('RT-DetectedAutoGenerated') ) {
@@ -775,7 +786,7 @@
 
                 # Don't send to any watchers.
                 @{ $self->{$_} } = () for (@EMAIL_RECIPIENT_HEADERS);
-                $RT::Logger->info( $msgid
+                $RT::Logger->info( $msgidwithtxid
                         . " The incoming message was autogenerated. "
                         . "Not redistributing this message based on site configuration."
                 );
@@ -791,7 +802,7 @@
                         push @blacklist, $addr if ( !$user->Privileged );
                     }
                 }
-                $RT::Logger->info( $msgid
+                $RT::Logger->info( $msgidwithtxid
                         . " The incoming message was autogenerated. "
                         . "Not redistributing this message to unprivileged users based on site configuration."
                 );
@@ -819,11 +830,11 @@
          # Weed out any RT addresses. We really don't want to talk to ourselves!
          # If we get a reply back, that means it's not an RT address
             if ( !RT::EmailParser->CullRTAddresses($addr) ) {
-                $RT::Logger->info( $msgid . "$addr appears to point to this RT instance. Skipping" );
+                $RT::Logger->info( $msgidwithtxid . "$addr appears to point to this RT instance. Skipping" );
                 next;
             }
             if ( grep /^\Q$addr\E$/, @blacklist ) {
-                $RT::Logger->info( $msgid . "$addr was blacklisted for outbound mail on this transaction. Skipping");
+                $RT::Logger->info( $msgidwithtxid . "$addr was blacklisted for outbound mail on this transaction. Skipping");
                 next;
             }
             push @addrs, $addr;
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Reply via email to