【问题标题】:Deleting messages from graylog2 using a pattern matching使用模式匹配从 graylog2 中删除消息
【发布时间】:2019-02-25 14:29:56
【问题描述】:

我正在尝试找到正确的语法/查询,以根据与“源”字段匹配的模式(如见于 graylog webui)。

我已经尝试了很多组合,但都不起作用:

root@log [~]: curl -XDELETE 'http://localhost:9200/graylog_71/message/_query' -d'{"query" : {"term": { "source" : "exact_server_name_here"}}}'
{"found":false,"_index":"graylog_71","_type":"message","_id":"_query","_version":2,"_shards":{"total":1,"successful":1,"failed":0}}

再试一次:

root@log [~]: curl -XDELETE 'http://localhost:9200/graylog_71/message/_query' -d '                                                             
{
  "query": {
    "query_string" : {
      "query" : "exact_server_name_here"
    }
  }
}
'

我还检查了这个 SO 帖子,它有效,但不符合我的需求: Delete a specific log message from Graylog

回答 val 评论:是的,删除插件已安装(我在最初的帖子中忘了提及这一点)

忍受我是 ES 新手 :)

谢谢

[编辑#1] 根据 Val 要求:

root@log [~]: curl 'localhost:9200/_cat/plugins?v'
name component version type url

【问题讨论】:

  • 你可能没有删除查询插件。见这里:stackoverflow.com/questions/40395463/…
  • @Val 已安装,我更新了我的问题,谢谢
  • 根据你得到的回复,它正在尝试删除一个id为_id的文档...你能运行这个curl 'localhost:9200/_cat/plugins?v'吗?
  • 你是否为 elasticsearch 安装了 delete_by_query 插件?
  • @AHT :是的,我这样做了安装了删除插件 :)

标签: elasticsearch graylog2


【解决方案1】:

好吧,我的错,ES新手不原谅一切,插件实际上已安装,但需要重新启动ES才能使其可用(如_cat/plugin查询中所示)

重新启动后,以下查询可以完美运行(当然):

curl -XDELETE 'http://localhost:9200/graylog_68/message/_query' -d '
{
  "query": {
    "query_string" : {
      "query" : "source : <exact_server_name_here>"
    }
  }
}
'

感谢 Val 的指点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-29
    • 1970-01-01
    • 2019-10-11
    • 2014-11-24
    • 2019-11-05
    • 2020-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多