[exim] Re: Show regex capture group in logs?

Top Page
Delete this message
Reply to this message
Author: Andrew C Aitchison
Date:  
To: MRob
CC: exim-users
Subject: [exim] Re: Show regex capture group in logs?
On Tue, 16 May 2023, MRob via Exim-users wrote:

> On 2023-05-16 20:08, Andrew C Aitchison via Exim-users wrote:
>> On Tue, 16 May 2023, MRob via Exim-users wrote:
>>
>>> Hi, I want to capture part of a regex match (capture group) to put in
>>> logs. This example using subject header works but is there a better way?
>>>
>>> warn set acl_c_temp = ${if match{$h_Subject:}{<regex with capture 
>>> group>}{$1}{none}}
>>>     !condition = ${if eq{$acl_c_temp}{none}}
>>>     logwrite = Notice: subject match is: $acl_c_temp

>>>
>>> This also risky because must be careful to make sure "none" could never
>>> come from the regex match group
>>>
>>> PS: is there better local variable to use?
>>
>> Since it is just conditional logging of a header
>> would a system filter be the place for this ?
>
> Sorry Im a beginner so I don't know yet much about those or when it's best to
> use them. Jeremy made it sound that your suggesting is an unnecessary burden
> but if there's something youre suggesting I love to learn! (note it's
> conditional logging of *part* of a header)


Sorry, I missed that you are only logging *part* of a header.
Usually I find that when I do that sort of thing I don't have the piece of
information that would explain the incident.

A system filter is like a .forward, but applied to all mail,
not just that of one user.
Unless you already have one, you are better off doing this in the
main config.

-- 
Andrew C. Aitchison                      Kendal, UK
                    andrew@???


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/