弹性警报格式的项目列表

时间:2019-07-25 21:56:36

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

我有使用聚合从查询中检索到的项目的列表。我想在电子邮件中打印此项目列表,每个项目都显示在单独的行中。现在,我可以打印所有内容,但是所有内容都一个接一个地打印,即.ForMember ( d => d.BarCodes, p => p.MapFrom ( s => (new [] { s.BarCode1, s.BarCode2, s.BarCode3 }) .Where( x => x != null) .Select( x => new EanCode { Code = x } ) .ToList() ) ); 。我希望它看起来像

file1.txt file2.txt

下面是创建电子邮件的动作。

file1.txt
file2.txt

我可以用这种方式打印物品吗?

1 个答案:

答案 0 :(得分:0)

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

"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>"
    }
  }
}