# Square brackets in ingest node grok pattern

**URL:** https://discuss.elastic.co/t/square-brackets-in-ingest-node-grok-pattern/67978
**Category:** Elasticsearch
**Created:** [December 5, 2016, 4:16am UTC](https://discuss.elastic.co/t/square-brackets-in-ingest-node-grok-pattern/67978 "2016-12-05T04:16:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wenyao](https://avatars.discourse-cdn.com/v4/letter/w/34f0e0/32.png) [@wenyao](https://discuss.elastic.co/u/wenyao)
#### Post date: [December 5, 2016, 4:16am UTC](https://discuss.elastic.co/t/square-brackets-in-ingest-node-grok-pattern/67978/1 "2016-12-05T04:16:07Z")

</div>

I am trying to convert my logstash configs into ingest node pipelines.

In my previous logstash config, the grok pattern contains square brackets which looks like this:

> \[%{DATA:loglevel}\] %{TIMESTAMP\_ISO8601:datetime} \[%{DATA:handler}\] - %{GREEDYDATA:errorMsg}

However, i cant add the blackslash before [and] in my .json pipeline definitions and it does not seem to work when i remove the blackslashes or when i add a double backslash in front.

How can i capture the data within square brackets for ingest nodes grok filters?

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 5, 2016, 10:06am UTC](https://discuss.elastic.co/t/square-brackets-in-ingest-node-grok-pattern/67978/2 "2016-12-05T10:06:19Z")

</div>

Hey,

how about this?

```auto
POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "description": "describe pipeline",
    "processors": [
      {
        "grok": {
          "field": "message",
          "patterns": [
            "\\[%{DATA:loglevel}\\] %{GREEDYDATA:errorMsg}"
          ]
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "message": "[INFO] what ever else comes here"
      }
    }
  ]
}

```

--Alex

---

<div class="post-metadata">

### Author: ![wenyao](https://avatars.discourse-cdn.com/v4/letter/w/34f0e0/32.png) [@wenyao](https://discuss.elastic.co/u/wenyao)
#### Post date: [December 5, 2016, 10:16am UTC](https://discuss.elastic.co/t/square-brackets-in-ingest-node-grok-pattern/67978/3 "2016-12-05T10:16:37Z")

</div>

It does not work. I did mention in my previous post that i already tried it out with double backslashes

---

<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: [January 2, 2017, 10:16am UTC](https://discuss.elastic.co/t/square-brackets-in-ingest-node-grok-pattern/67978/4 "2017-01-02T10:16:51Z")

</div>

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