# Parsing using grok

**URL:** <https://discuss.elastic.co/t/parsing-using-grok/260916>\
**Category:** Logstash\
**Created:** [January 12, 2021, 10:18pm UTC](https://discuss.elastic.co/t/parsing-using-grok/260916 "2021-01-12T22:18:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [January 12, 2021, 10:18pm UTC](https://discuss.elastic.co/t/parsing-using-grok/260916/1 "2021-01-12T22:18:08Z")

</div>

i am running jdbc and getting following data. if I run this on SQL\> prompt

```
--backupid "2129214415_30120163393540,2129214415_30120163432904" --spoolpath /system1/1_backup

```

but on logstash output it becomes

```
command: "--backupid \"2129214415_30120163393540,2129214415_30120163432904\" --spoolpath /system1/1_backup"

```

how do I parse this and get 2129214415\_30120163393540

I try this but it does not work

```
grok {
             tag_on_failure => ["grok_parse_failed"]
             match => {"command" => "--backupid \\"%{GREEDYDATA:myid},%{GREEDYDATA:myid2}\\" }
}

```

I even try with different \ combination to esacpe that backslash and "

it works on grok debugger when I try

this works  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/9/39be3b0bfed30dd46972b63dd6dbed09206843a6.png)

This works as well

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/0/d0bb7e2677cb81d0a61423222079a64b15b85e79.png)

---

<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:** [January 13, 2021, 12:14am UTC](https://discuss.elastic.co/t/parsing-using-grok/260916/2 "2021-01-13T00:14:35Z")

</div>

> [@elasticforme](#):
>
> `command: "--backupid \"2129214415_30120163393540,2129214415_30120163432904\" --spoolpath /system1/1_backup"`

The actual value of the command field is `--backupid "2129214415_30120163393540,2129214415_30120163432904" --spoolpath /system1/1_backup"`. There are no backslashes in it, those are just being used as escapes for the double quotes inside the string. Try

```
match => { "command" => '--backupid "%{DATA:myid1},%{DATA:myid2}"' }

```

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [January 13, 2021, 3:40pm UTC](https://discuss.elastic.co/t/parsing-using-grok/260916/3 "2021-01-13T15:40:11Z")

</div>

Thank you Badger.

that single quote I didn't know I can use it. plus DATA in place of GREEDYDATA

---

<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:** [February 10, 2021, 3:40pm UTC](https://discuss.elastic.co/t/parsing-using-grok/260916/4 "2021-02-10T15:40:12Z")

</div>

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