# How to eliminate square brackets in the parsed logs

**URL:** https://discuss.elastic.co/t/how-to-eliminate-square-brackets-in-the-parsed-logs/248502
**Category:** Logstash
**Created:** [September 14, 2020, 9:38am UTC](https://discuss.elastic.co/t/how-to-eliminate-square-brackets-in-the-parsed-logs/248502 "2020-09-14T09:38:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![prajwalgmpp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prajwalgmpp/32/47707_2.png) [@prajwalgmpp](https://discuss.elastic.co/u/prajwalgmpp)
#### Post date: [September 14, 2020, 9:38am UTC](https://discuss.elastic.co/t/how-to-eliminate-square-brackets-in-the-parsed-logs/248502/1 "2020-09-14T09:38:21Z")

</div>

The pattern is : ` match => { "message" => "%{SYSLOG5424SD:time}%{SYSLOG5424SD:level}%{SYSLOG5424SD:message} %{SYSLOG5424SD:node} realm %{SYSLOG5424SD} authenticated user %{SYSLOG5424SD:user}, with roles %{SYSLOG5424SD:role}" }`

And the parsed output is `[2020-09-14T09:28:05,343][DEBUG][o.e.x.s.a.e.NativeRealm] [cle-data-0] realm [native1] authenticated user [logstash_admin_user], with roles [[logstash_admin, logstash_system, superuser]], [o.e.x.s.a.e.NativeRealm]`

How can I eliminate the square brackets in the output?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [September 14, 2020, 1:51pm UTC](https://discuss.elastic.co/t/how-to-eliminate-square-brackets-in-the-parsed-logs/248502/2 "2020-09-14T13:51:09Z")

</div>

Use mutate+gsub. Something like

```
mutate { gsub => ["message", "[\[\]]", "" ] }
```

---

<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: [October 12, 2020, 1:51pm UTC](https://discuss.elastic.co/t/how-to-eliminate-square-brackets-in-the-parsed-logs/248502/3 "2020-10-12T13:51:12Z")

</div>

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