【问题标题】:Deleting elasticsearch indices which are older than an hour via curator通过 curator 删除超过一小时的弹性搜索索引
【发布时间】:2016-04-22 11:04:03
【问题描述】:

我在 elasticsearch 中有一些索引,其命名格式为 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

【问题讨论】:

    标签: elasticsearch elasticsearch-curator


    【解决方案1】:

    正如 untergeek here 所解释的那样

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

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

    【讨论】:

      【解决方案2】:

      你快到了,你只是错过了--prefix option

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

      【讨论】:

      • 你好像在前缀后面加了-,你不应该。
      • 同样的错误。 2016-04-22 17:09:13,202 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 不匹配,因为t
      • 哦,只要去掉时间字符串周围的单引号!
      • 运气不好 :( 。输入的时间字符串为 %Y-%m-%dt%H
      【解决方案3】:

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

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-13
      • 1970-01-01
      • 2015-05-23
      • 2016-01-30
      • 1970-01-01
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      相关资源
      最近更新 更多