Retention Rules Build / Query

Issue #1236 closed
Thomas Helmrich created an issue

Hi,

i have a question regarding the retention rules:

i defined a rule with following data:

from: test@test.tld
to: test-server@server.test.tld
Subject: Menu
Retention Period: 14

I except, that those should end into an AND query, so the message only gets a retention of 14 when from, to and Subect are matching.

Currently, the message get a retention period of 14, when one of the definition is matching (like an OR).

Is that the excepted behaviour or an bug?

Thanks!
Thomas

Comments (6)

  1. Janos SUTO repo owner

    It’s definitely not the expected behaviour, they are supposed to be in a Boolean AND relation. I’ll check it for myself, and let you know.

  2. Janos SUTO repo owner

    I couldn’t reproduce it. I have the following retention rule returning 10 days when the email matches the following:

    From: bela@acts.hu
    To: sanyi@aaa.fu
    Subject: test

    MariaDB [piler]> select * from retention_rule;
    +----+--------+--------------+--------------+---------+------+-------+------+-----------------+-----------------+------------------+-----------------+------+------+-----------+
    | id | domain | from         | to           | subject | body | _size | size | attachment_name | attachment_type | _attachment_size | attachment_size | spam | days | folder_id |
    +----+--------+--------------+--------------+---------+------+-------+------+-----------------+-----------------+------------------+-----------------+------+------+-----------+
    |  1 |        | bela@acts.hu | sanyi@aaa.fu | test    |      | >     |    0 |                 |                 | >                |               0 |   -1 |   10 |         0 |
    +----+--------+--------------+--------------+---------+------+-------+------+-----------------+-----------------+------------------+-----------------+------+------+-----------+
    

    test1.eml:

    From: bela@acts.hu
    To: sanyi@aaa.fu
    Date: Wed, 9 Dec 2020 10:35:24 +0100
    Subject: test email
    Message-ID: <akakaka@akaka10006>
    
    akakakak asjsjsjs
    

    test2.eml:

    From: bela@acts.hu
    To: jhjjjhjh@aaa.fu
    Date: Wed, 9 Dec 2020 10:35:24 +0100
    Subject: some subject
    Message-ID: <akakaka@akaka10006>
    
    akakakak asjsjsjs
    

    test3.eml:

    From: hjkjjkk@bbb.fu
    To: sanyi@aaa.fu
    Date: Wed, 9 Dec 2020 10:35:24 +0100
    Subject: other things
    Message-ID: <akakaka@akaka10006>
    
    akakakak asjsjsjs
    

    Now let’s run pilertest against them.

    piler returns 10 days for test1.eml as it should:

    # pilertest -m test1.eml 
    locale: C
    build: 1001
    parsing...
    post parsing...
    message-id: <akakaka@akaka10006> / 2fd0ac77bf34a6ce34d39052611ed2fabc3f8c115ff38951b969e57cee1ba39d
    from: *bela@acts.hu bela acts hu  (acts.hu)*
    sender: * ()*
    to: *sanyi@aaa.fu sanyi aaa fu  (aaa.fu )*
    journal recipients: **
    reference: **
    subject: *test email*
    body: *akakakak asjsjsjs *
    sent: 1607506524, delivered-date: 0
    hdr len: 127
    body digest: 34ea2a903e889057df4e8eb3d8c7a1dead0535566893d3142892305690626231
    rules check: (null)
    folder: 0
    retention period: 1608370524 (10 days)
    attachments:
    direction: 1
    spam: 0
    1st received line: 
    

    And it returns the default 2557 days for the other 2 emails:

    # pilertest -m test2.eml 
    locale: C
    build: 1001
    parsing...
    post parsing...
    message-id: <akakaka@akaka10006> / 2fd0ac77bf34a6ce34d39052611ed2fabc3f8c115ff38951b969e57cee1ba39d
    from: *bela@acts.hu bela acts hu  (acts.hu)*
    sender: * ()*
    to: *jhjjjhjh@aaa.fu jhjjjhjh aaa fu  (aaa.fu )*
    journal recipients: **
    reference: **
    subject: *some subject*
    body: *akakakak asjsjsjs *
    sent: 1607506524, delivered-date: 0
    hdr len: 132
    body digest: 34ea2a903e889057df4e8eb3d8c7a1dead0535566893d3142892305690626231
    rules check: (null)
    folder: 0
    retention period: 1828431324 (2557 days)
    attachments:
    direction: 1
    spam: 0
    1st received line: 
    

    and

    # pilertest -m test3.eml 
    locale: C
    build: 1001
    parsing...
    post parsing...
    message-id: <akakaka@akaka10006> / 2fd0ac77bf34a6ce34d39052611ed2fabc3f8c115ff38951b969e57cee1ba39d
    from: *hjkjjkk@bbb.fu hjkjjkk bbb fu  (bbb.fu)*
    sender: * ()*
    to: *sanyi@aaa.fu sanyi aaa fu  (aaa.fu )*
    journal recipients: **
    reference: **
    subject: *other things*
    body: *akakakak asjsjsjs *
    sent: 1607506524, delivered-date: 0
    hdr len: 131
    body digest: 34ea2a903e889057df4e8eb3d8c7a1dead0535566893d3142892305690626231
    rules check: (null)
    folder: 0
    retention period: 1828431324 (2557 days)
    attachments:
    direction: 0
    spam: 0
    1st received line: 
    

    Can you build the latest master (and not install it), and run pilertest from the build dir?

  3. Thomas Helmrich reporter

    iam on current master.
    ok - what i see is, when domain is defined, it seems to do the mismatch?
    Regarding Subject: Ist it a Wildcard on test, so test must only appear? or is it a exact match on subject test

    wiil provide a debug set!

  4. Thomas Helmrich reporter

    On first try outs, it looks like the set of “domain” with the other fields did the issue

  5. Janos SUTO repo owner

    It must only appear. The domain part should be relevant for the discontinued saas feature. I suggest not to use it.

  6. Log in to comment