【问题标题】:Elastic alert format list of items弹性警报格式项目列表
【发布时间】:2019-07-25 21:56:36
【问题描述】:

我有一个使用聚合从我的查询中检索到的项目列表。我想在我的电子邮件中打印这个项目列表,每个项目都出现在单独的行上。现在我可以打印所有内容,但它们一个接一个出现,即file1.txt file2.txt。我希望它看起来像

file1.txt
file2.txt

以下是创建电子邮件的操作。

"actions": {
    "email_users": {
        "email": {
            "profile": "standard",
            "to": [
                "jcarpenter@mydomain.com"
            ],
            "subject": "File Identifier",
            "body": {
                "html": "<p>Files could not be identified due bad receiver id.  There were {{ctx.payload.hits.total}} files that could not be identified.</p> <ul><li>{{#ctx.payload.aggregations.file_name.buckets}}{{key}}{{/ctx.payload.aggregations.file_name.buckets}}</li></ul>"
            }
        }
    }

我可以这样打印项目吗?

【问题讨论】:

    标签: elasticsearch kibana elastic-stack elasticsearch-x-pack


    【解决方案1】:

    我能够使用以下命令格式化项目。

    "actions": {
    "email_users": {
      "email": {
        "profile": "standard",
        "to": [
          "jcarpenter@mydomain.com"
        ],
        "subject": "File Identifier",
        "body": {
          "html": "<p>Files could not be identified due bad receiver id.  There were {{ctx.payload.hits.total}} files that could not be identified.</p> <div><ul>{{#ctx.payload.aggregations.file_name.buckets}}{{#key}}<li>{{.}}</li>{{/key}}{{/ctx.payload.aggregations.file_name.buckets}}</ul></div><p>These files have been sent to quarantine.</p>"
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-29
      • 2020-06-28
      • 1970-01-01
      • 2015-12-28
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      相关资源
      最近更新 更多