0

我在弹性搜索中有一些索引,其命名格式为elk-console-YYYY-MM-DDtHH. 例如:-

elk-console-2016-03-30t14
elk-console-2016-03-30t16

我想使用curator删除所有超过 1 小时的索引。所以我尝试执行以下命令: -

curator --host localhost delete indices --older-than 1 --time-unit hours --timestring '%Y-%m-%dt%H'

但它给了我以下输出: -

2016-04-22 16:27:36,049 INFO      Job starting: delete indices
2016-04-22 16:27:36,058 INFO      Pruning Kibana-related indices to prevent accidental deletion.
2016-04-22 16:27:36,058 WARNING   No indices matched provided args: {'regex': None, 'index': (), 'suffix': None, 'newer_than': None, 'closed_only': False, 'prefix': None, 'time_unit': 'hours', 'timestring': u'%Y-%m-%dt%H', 'exclude': (), 'older_than': 1, 'all_indices': False}
No indices matched provided args: {'regex': None, 'index': (), 'suffix': None, 'newer_than': None, 'closed_only': False, 'prefix': None, 'time_unit': 'hours', 'timestring': u'%Y-%m-%dt%H', 'exclude': (), 'older_than': 1, 'all_indices': False}

我还尝试执行以下命令:-

curator --host localhost delete indices --older-than 1 --time-unit hours --timestring '%Y-%m-%dt%H' --prefix elk-console-

但仍然收到以下错误:-

2016-04-22 16:48:43,848 INFO      Job starting: delete indices
2016-04-22 16:48:43,856 INFO      Pruning Kibana-related indices to prevent accidental deletion.
2016-04-22 16:48:43,856 WARNING   No indices matched provided args: {'regex': None, 'index': (), 'suffix': None, 'newer_than': None, 'closed_only': False, 'prefix': u'elk-console-', 'time_unit': 'hours', 'timestring': u'%Y-%m-%dt%H', 'exclude': (), 'older_than': 1, 'all_indices': False}
No indices matched provided args: {'regex': None, 'index': (), 'suffix': None, 'newer_than': None, 'closed_only': False, 'prefix': u'elk-console-', 'time_unit': 'hours', 'timestring': u'%Y-%m-%dt%H', 'exclude': (), 'older_than': 1, 'all_indices': False}

有人可以帮我timestring在我的情况下使用什么格式吗?

环境:-

  • 策展人 3.5.1
  • 弹性搜索 - 2.3.1
4

3 回答 3

2

正如 untergeek这里所解释的那样

问题在于它将t视为特殊字符,例如 a .或 a -。这是我第一次遇到使用这种语法的人,因为大多数人都使用连字符或点来分隔事物。

我可能会将修复移植到 3.x,但很有可能我不会。我现在将修复添加到 4.x 分支。

于 2016-04-25T16:07:30.450 回答
0

你快到了,你只是错过了--prefix选择

curator --host localhost delete indices --older-than 1 --time-unit hours --timestring %Y-%m-%dt%H --prefix elk-console
于 2016-04-22T11:07:15.767 回答
0

问题可能是索引名称模式反映了本地时间,但 Curator 使用 UTC 进行计算。解决方案是软件更改以允许时区偏移。

于 2016-04-23T16:51:15.960 回答