logstash 如何将webhook json有效负载发送到ElasticSearch索引

rqcrx0a6  于 2022-12-09  发布在  Logstash
关注(0)|答案(1)|浏览(191)

我的目标是,每当我的webhook收到POST请求时,我希望将json有效负载发送到ElasticSearch索引。
为此,我使用了带有HTTP插件的Logstash管道。当我使用来自本地配置在端口9000上的webhook的输入时,我可以在本地配置webhook时发送webhook消息

input {
  http {
    host => "0.0.0.0"
    port => "9000"
    codec => "json"
  }
}
filter {
    mutate {
        add_field => {
          "documentType" => "productionlogs"
          "deleted" => "false"
          "created" => "%{@timestamp}"
          "modified" => "%{@timestamp}"
          }
    }
}
output {
  elasticsearch {
    hosts    => [ '${ES_HOST_ADDRESS}' ]
    user     => '${ES_USER}'
    password => '${ES_PASSWORD}'
    ssl => "true"
    index => "production_logs"
  }
  stdout {
    id => "Pipeline_logs"
    codec => "json"
  }
}

但是当我使用来自“www.example.com“的外部webhook端点时https://requestinspector.com/,
第一次
需要帮忙吗?谢谢

9jyewag0

9jyewag01#

您只需要在第5行写入==>而不是=>;- )

ssl ==> "true"

应道:

ssl => "true"

Expected one of ...开头的错误通常是打字错误/缺少括号/等。

相关问题