Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

[BUG] Policy with CRON transition: [illegal_argument_exception] Unknown schedule type expression #89

Open
davide-malagoli opened this issue May 13, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@davide-malagoli
Copy link

Describe the bug
I'm trying to define a policy that deletes an "old" index at midnight.

I'm using Opendistro 1.4 and from the documentation I see it would be possible to use CRON expressions ( Transitions )

But when I try t save it gives me an error

[illegal_argument_exception] Unknown schedule type expression

Other plugins installed
No other plugin installed

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Index Management'
  2. Click on 'Create Policy'
  3. Insert 'delete_at_midnight' in the 'Policy ID' field
  4. Paste the following definition
 {
    "policy": {
        "policy_id": "delete_at_midnight",
        "description": "A simple default policy that deletes old indicies after 1 days.",
        "default_state": "open",
        "states": [
            {
                "name": "open",
                "actions": [
                    {
                        "open": {}
                    }
                ],
                "transitions": [
                    {
                        "state_name": "delete",
                        "conditions": {
                            "cron": {
                                "expression":"1 0 * * *",
                                "timezone":"CET"
                            }
                        }
                    }
                ]
            },
            {
                "name": "delete",
                "actions": [
                    {
                        "delete": {}
                    }
                ],
                "transitions": []
            }
        ]
    }
}

  1. See error

Expected behavior
Kibana saves the policy

Desktop (please complete the following information):

  • OS: Ubuntu 18.04.4 LTS
  • Browser: chrome
  • Version 81.0.4044.92
@davide-malagoli davide-malagoli added the bug Something isn't working label May 13, 2020
@dbbaughe
Copy link
Contributor

Hi @davide-malagoli,

Seems like our syntax got a little screwed up with the parsers.
You'll have to do something like:

{
  "cron": {
    "cron": {
      ...
    }
  }
}

We'll fix it so the single "cron" object works and keep this way just to make sure it doesn't break for anyone that had to write it this way for future versions.

@dbbaughe dbbaughe reopened this May 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants