【问题标题】:Send request to elastic watcher via curl通过 curl 向弹性观察者发送请求
【发布时间】:2020-04-20 20:39:16
【问题描述】:

ELK 7.X

我正在尝试使用输入文件创建带有 curl 的弹性搜索观察程序。像这样的

curl -X PUT _watcher/watch/cluster_health_watch --data-binary @inputFile

1) 要使用的文件类型是什么?大部分数据是json,但是在发送邮件的“actions”字段中,邮件正文可以是HTML!

2) 有什么方法可以从外部文件引用正文中的 HTML,例如输入文件可以是 json 吗?

【问题讨论】:

  • 你得到什么回应?
  • 我无法将文件作为 json 传递,因为它在电子邮件部分包含 html 正文
  • 我的意思是您从 elasticsearch 收到的确切错误消息

标签: elasticsearch kibana-7


【解决方案1】:

只是通过添加“\”来转义html字符串中的双引号。

例如:-

<h3 style=\"color:red\"></h3>
"actions": {
    "send_email": {
      "email": {
        "to": "xxxx@gmail.com",
        "subject": "My Subject",
        "body": {
          "html": "<h3 style=\"color:red\"> There was a problem</h3>"
        }
      }
    }
  }
curl -X PUT _watcher/watch/cluster_health_watch -H 'Content-Type: application/json' --data-binary @inputFile.json

【讨论】:

    猜你喜欢
    • 2014-07-28
    • 1970-01-01
    • 2018-06-21
    • 2017-04-23
    • 1970-01-01
    • 2018-04-12
    • 2020-10-07
    • 1970-01-01
    • 2014-01-28
    相关资源
    最近更新 更多