# Remove double quotes from grok output

**URL:** https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822
**Category:** Logstash
**Created:** [December 13, 2019, 5:06pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822 "2019-12-13T17:06:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)
#### Post date: [December 13, 2019, 5:06pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/1 "2019-12-13T17:06:25Z")

</div>

Hello,

Anyone know how to remove the double quotes out of the grok output ?

After grok filter, the ouput is "ip": "7.7.7.7", i would like to remove quotes and have an output like "ip": 7.7.7.7

I'm trying with gsub mutate options but escaping quotes seemes impossible.

```auto
filter {    
    mutate {
        gsub => ["ip", "\"", ""]
    }
}

Any solution please,
```

---

<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: [December 13, 2019, 8:25pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/2 "2019-12-13T20:25:34Z")

</div>

The quotes indicate it is a string datatype. There is no way to remove them.

---

<div class="post-metadata">

### Author: ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)
#### Post date: [December 13, 2019, 9:59pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/3 "2019-12-13T21:59:21Z")

</div>

Hello Badger,

Thnx for your response but is it possible to create ip datatype in logstash ?  
I have to post some fields(like ipadress) to another server using soap webservice output in logstash, how can i do it ,i need to send ip address without quotes.

Thnx in advance

---

<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: [December 14, 2019, 2:56pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/4 "2019-12-14T14:56:57Z")

</div>

logstash does not have an ip datatype. What does your output configuration look like?

---

<div class="post-metadata">

### Author: ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)
#### Post date: [December 16, 2019, 2:01pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/5 "2019-12-16T14:01:54Z")

</div>

Hi again,

I receive syslogs data from rsyslog server and after preprossing using grok, i obtain fields like host,port, ipadress,timestamp which are strings after grok filter,..

I m using logstash http output to post some fields to another remote server,  
i have to post ip adress & port ,the other server can receive filed without quotes because they are defined as integer at his side,so i could convert port to integer using mutate filter and the quotes were removed but i could not convert ipadress field to escaping these quotes.

below the request :

http  
{  
http\_method =\> "post"  
url =\> "[http://X.X.X.X/abc/abc](http://X.X.X.X/abc/abc)"

```
      content_type => "text/xml;charset=UTF-8"

     format => "message"
    message => '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope 

```

xmlns:soapenv="[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)"  
xmlns:ws="[http://X.X](http://X.X)..X.X"\>  
\<soapenv:Header xmlns:svsec="[http://X.X.X.X](http://X.X.X.X)"\>  
svsec:usernameX\</svsec:username\>  
svsec:passwordY\</svsec:password\> \</soapenv:Header\>

soapenv:Body  
ws:CreateNatMappingRequest

```
     <Debug>false</Debug>
     <NatRecord>
       
        <PrivateIpEndpoint>
           
           <IpAddress>%{ipadress}</IpAddress>
           
          <SessionQualifier>
                        <SiteNumber>4</SiteNumber>
                    </SessionQualifier>
        </PrivateIpEndpoint>
        
        <PublicIpEndpoint>
           
           <IpAddress>%{ipadresse2}</IpAddress>
           
           <SessionQualifier>
                        <LowPort>%{port}</LowPort>
                        <HighPort>%{port}</HighPort>
                    </SessionQualifier>
        </PublicIpEndpoint>
     </NatRecord>
  </ws:CreateNatMappingRequest>

```

\</soapenv:Body\> \</soapenv:Envelope\>'  
}  
stdout { codec =\> rubydebug }  
}

---

<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: [December 16, 2019, 3:25pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/6 "2019-12-16T15:25:33Z")

</div>

If you do a sprintf substitution of a field that is a string then it does not include quotes.

---

<div class="post-metadata">

### Author: ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)
#### Post date: [December 16, 2019, 3:40pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/7 "2019-12-16T15:40:09Z")

</div>

You mean ${ipadresse2} instead of %{ipadresse2} ?

I yes i tried it but i have error Cannot evaluate `${ipadresse2}`

---

<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: [December 16, 2019, 3:45pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/8 "2019-12-16T15:45:35Z")

</div>

No, I am saying that in something like

> [@Intissar\_Ayadi](#):
>
> \<IpAddress\>%{ipadress}\</IpAddress\>

there will be no double quotes.

---

<div class="post-metadata">

### Author: ![Intissar\_Ayadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/intissar_ayadi/32/59264_2.png) [@Intissar\_Ayadi](https://discuss.elastic.co/u/Intissar_Ayadi)
#### Post date: [December 23, 2019, 1:47pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/9 "2019-12-23T13:47:46Z")

</div>

Hello,

Thx ,indeed there will be no double quotes.

Bsr,

---

<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 20, 2020, 1:47pm UTC](https://discuss.elastic.co/t/remove-double-quotes-from-grok-output/211822/10 "2020-01-20T13:47:54Z")

</div>

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