# How to Limit Message Length in Watcher Json File

**URL:** https://discuss.elastic.co/t/how-to-limit-message-length-in-watcher-json-file/253581
**Category:** Elasticsearch
**Created:** [October 28, 2020, 3:17pm UTC](https://discuss.elastic.co/t/how-to-limit-message-length-in-watcher-json-file/253581 "2020-10-28T15:17:17Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mdamera](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@mdamera](https://discuss.elastic.co/u/mdamera)
#### Post date: [October 28, 2020, 3:17pm UTC](https://discuss.elastic.co/t/how-to-limit-message-length-in-watcher-json-file/253581/1 "2020-10-28T15:17:17Z")

</div>

Hello Everyone,

I have following lines on a watcher Json configuration file and I would like to trim/limit the {{\_source.message}} to 3000 characters in the email alert

Can anyone help me how can we do that ?

```auto
"body": {
          "html": "<html><body><h4>{{xxx.payload.hits.total}} errors found in the xx logs</h4><br><br><table width=100% border=1>{{#xxx.payload.hits.hits}}<tr width=100%><td width=30%><b>LogId=</b>{{_id}}<br><b>Module=</b>{{_source.applicationName}}<br><b>Host=</b>{{_source.host}}<br><b>Source=</b>{{_source.source}}</td><td width=70%>{{_source.message}}</td></tr>{{/xxx.payload.hits.hits}}</table></body></html>"
        }

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 25, 2020, 3:17pm UTC](https://discuss.elastic.co/t/how-to-limit-message-length-in-watcher-json-file/253581/2 "2020-11-25T15:17:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
