【问题标题】:how can insert, update, delete automatically in elastic using logstash如何使用logstash在弹性中自动插入、更新、删除
【发布时间】:2020-05-14 15:41:17
【问题描述】:

如何使用 logstash 在 elastic 中自动插入、更新、删除?

在我的输入语句中,我得到了操作(插入、更新、删除),当我只插入或只更新时它工作正常,但如果进程运行插入和更新或删除它会抛出错误代码 => 400 ,%c => "http://ip:9200 / _bulk action =>

output{
# Para ELK
        elasticsearch {
                    hosts => "localhost:9200"
                    index => "hca_001"
                    document_type => "hca_001_lgs"
                    document_id => "%{hca_numero}%{hca_anio}"
                    action => "%{my_accion}"   
                    doc_as_upsert => true
                    manage_template => false        
        }
}

【问题讨论】:

标签: elasticsearch logstash logstash-configuration


【解决方案1】:

您是否尝试过使用条件句?

output{
  if [my_accion] == "delete" {
        elasticsearch {
                    action => "delete"   
                    ...  
        }
  } else {
        elasticsearch {
                    action => "update"
                    doc_as_upsert => true   
                    ...  
        }
  }
}

这在过去为我解决了类似的问题。

【讨论】:

  • 我已经尝试过了,它在 .conf 文件中抛出了错误。我要再试一次,也许是我忘记了一些钥匙。 :) 谢谢。
猜你喜欢
  • 1970-01-01
  • 2011-11-08
  • 2020-08-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多