apiVersion: v1
kind: ConfigMap
metadata:
  name: curator-config
data:
  action_file.yml: |-
    ---
    # Remember, leave a key empty if there is no value.  None will be a string,
    # not a Python "NoneType"
    #
    # Also remember that all examples have 'disable_action' set to True.  If you
    # want to use this action as a template, be sure to set this to False after
    # copying it.
    actions:
      1:
        action: reindex
        description: "Reindex daily traefik logs"
        options:
          wait_interval: 9
          max_wait: -1
          request_body:
            source:
              index: <logstash-{now/d-1d}>
              query:
                bool:
                  must:
                  - term:
                      kubernetes.labels.name.keyword: traefik-ingress-lb
                  - term:
                      stream: stdout
            dest:
              index: <filebeat-6.2.2-traefik-{now/d-1d}>
              type: doc
              pipeline: filebeat-6.2.2-traefik-access-pipeline
            script:
              source: |-
                ctx._source.message = ctx._source.remove("log");
                ctx._source.remove("kubernetes");
                ctx._source.remove("stream");
                ctx._source.remove("tag");
                ctx._source.remove("docker");
                ctx._source.beat = ['name':ctx._source._type,'version':'6.2.2'];
                ctx._source.fileset = ['module':'traefik','name':'access'];
                ctx._source.prospector = ['type':'log'];
                ctx._source.source = ctx._source._id;
      2:
        action: delete_indices
        description: "Clean up ES by deleting old indices"
        options:
          timeout_override:
          continue_if_exception: False
          disable_action: False
          ignore_empty_list: True
        filters:
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y.%m.%d'
          unit: days
          unit_count: 90
          field:
          stats_result:
          epoch:
          exclude: False
  config.yml: |-
    ---
    # Remember, leave a key empty if there is no value.  None will be a string,
    # not a Python "NoneType"
    client:
      hosts:
        - elasticsearch
      port: 9200
      url_prefix:
      use_ssl: False
      certificate:
      client_cert:
      client_key:
      ssl_no_validate: False
      http_auth:
      timeout: 30
      master_only: False

    logging:
      loglevel: INFO
      logfile:
      logformat: default
      blacklist: ['elasticsearch', 'urllib3']
