# Special character handlling in the alert message

**URL:** https://discuss.elastic.co/t/special-character-handlling-in-the-alert-message/265285
**Category:** Kibana
**Tags:** elastic-stack-alerting
**Created:** [February 24, 2021, 7:25am UTC](https://discuss.elastic.co/t/special-character-handlling-in-the-alert-message/265285 "2021-02-24T07:25:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Piyush\_Gandhi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/piyush_gandhi/32/84443_2.png) [@Piyush\_Gandhi](https://discuss.elastic.co/u/Piyush_Gandhi)
#### Post date: [February 24, 2021, 7:25am UTC](https://discuss.elastic.co/t/special-character-handlling-in-the-alert-message/265285/1 "2021-02-24T07:25:09Z")

</div>

Hi,

I would like to print the request made value in my alerting messaging, however, when I formed the alert message, I was getting the ASCII values in my alert message.

Extraction query response:

```auto
{
    "_shards": {
        "total": 28,
        "failed": 0,
        "successful": 28,
        "skipped": 0
    },
    "hits": {
        "hits": [
            {
                "_type": "_doc",
                "_source": {
                    "request": "/healthcheck",
                },
            }
        ],
        "total": {
            "value": 335,
            "relation": "eq"
        },
        "max_score": 7.598394
    },
    "took": 32,
    "timed_out": false
}

```

Message:

```auto
Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
- Trigger: {{ctx.trigger.name}}
- Severity: {{ctx.trigger.severity}}
- Period start: {{ctx.periodStart}}
- Period end: {{ctx.periodEnd}}
- Total occurrences: {{ctx.results.0.hits.hits]}}

{{#ctx.results}}
{{#hits}}
{{#hits}}
{{#_source}}
--------------------------------------
Request: {{request}}
{{/_source}}
{{/hits}}
{{/hits}}
{{/ctx.results}}

```

The transformed message:

```auto
Monitor Error-log-monitor just entered alert status. Please investigate the issue.
- Trigger: Trigger http 5xx error
- Severity: 5
- Period start: 2021-02-24T06:57:10Z
- Period end: 2021-02-24T06:58:10Z
- Total occurrences: 
--------------------------------------
Request: &#x2F;healthcheck

```

I would like my message to be formed in the below manner:

```auto
The transformed message:
Monitor Error-log-monitor just entered alert status. Please investigate the issue.
- Trigger: Trigger http 5xx error
- Severity: 5
- Period start: 2021-02-24T06:57:10Z
- Period end: 2021-02-24T06:58:10Z
- Total occurrences: 
--------------------------------------
Request: /healthcheck

```

---

<div class="post-metadata">

### Author: ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)
#### Post date: [February 24, 2021, 12:53pm UTC](https://discuss.elastic.co/t/special-character-handlling-in-the-alert-message/265285/2 "2021-02-24T12:53:35Z")

</div>

Hey @Piyush_Gandhi, welcome to the discussion boards!

Kibana's alerting supports the "triple braces" form, which allows content to be rendered unescaped. Note that this is _potentially_ dangerous, as untrusted content can be interpreted as HTML or JavaScript depending on how it's being rendered.

From the [alerting docs](https://www.elastic.co/guide/en/kibana/current/defining-alerts.html):

> Mustache also supports "triple braces" of the form `{{{variable name}}}` , which indicates no escaping should be done at all. Care should be used when using this form, as it could end up rendering the variable content in such a way as to make the resulting parameter invalid or formatted incorrectly.

Can you try changing `{{request}}` to `{{{request}}}` in your message, and let me know if that works for you?

---

<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: [March 24, 2021, 12:54pm UTC](https://discuss.elastic.co/t/special-character-handlling-in-the-alert-message/265285/3 "2021-03-24T12:54:37Z")

</div>

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