Bug 1541948

Summary: RFE: Allow regular expressions in curator settings
Product: OpenShift Container Platform Reporter: Josef Karasek <jkarasek>
Component: LoggingAssignee: Josef Karasek <jkarasek>
Status: CLOSED ERRATA QA Contact: Anping Li <anli>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.7.1CC: anli, aos-bugs, bcankurt, jcantril, jkarasek, rmeggins, sradco
Target Milestone: ---   
Target Release: 3.7.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Feature: Allow regular expressions in curator settings Reason: Customer request Result: A special tag can be used in curator settings to specify custom regular expressions.
Story Points: ---
Clone Of: 1517875
: 1541952 (view as bug list) Environment:
Last Closed: 2018-04-05 09:37:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1517875    
Bug Blocks: 1541952    

Comment 3 Anping Li 2018-03-02 08:23:00 UTC

@josef, PR still not merged to the latest logging-curator-v3.7.36-1

sh-4.2$ diff /opt/app-root/src/run_cron.py /tmp/run_cron.py    
103c103,107
< default_command = base_default_cmd + ' --older-than ' + str(default_value) + ' --time-unit ' + default_time_unit + ' --exclude .searchguard* --exclude .kibana*'
---
> default_command = base_default_cmd \
>         + ' --older-than ' + str(default_value) \
>         + ' --time-unit ' + default_time_unit \
>         + ' --exclude ' + shellquote('^' + re.escape('.searchguard.') + '.*$') \
>         + ' --exclude ' + shellquote('^' + re.escape('.kibana.') + '.*$')
116,117d119
<                     default_command = default_command + " --exclude " + shellquote(re.escape(project + '.') + '*')
< 
125a128,129
>                     default_command = default_command \
>                             + " --exclude " + shellquote('^' + re.escape(this_project + '.') + '.*$')
151c155
<                 lambda project:'^' + re.escape(project + '.'),
---
>                 lambda project:'^' + re.escape(project + '.') + '.*$',

Comment 5 Anping Li 2018-03-06 10:53:11 UTC
[root@ip-172-18-1-175 ~]# oc get configmap logging-curator -o yaml
apiVersion: v1
data:
  config.yaml: |
    .defaults:
      delete:
        days: 30
      runhour: 0
      runminute: 0

    .operations:
      delete:
        weeks: 8

    myapp:
      delete:
        weeks: 1

    .regex:
    - pattern: '^project\..+\-dev\..*$'
      delete:
        days: 15
    - pattern: '^project\..+\-test\..*$'
      delete:
        days: 30


# oc logs logging-curator-2-kxnkd
The project name must match this regex: [^[a-z0-9]([-a-z0-9]*[a-z0-9])?$] This does not match: [.regex]

Comment 6 Josef Karasek 2018-03-12 15:47:42 UTC
The previous build did not have the latest code, let's wait for another one

Comment 7 Anping Li 2018-03-20 04:52:02 UTC
Verified with openshift3/logging-curator/images/v3.7.39-1

Comment 11 errata-xmlrpc 2018-04-05 09:37:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0636