# Remove HTTP encondings

**URL:** https://discuss.elastic.co/t/remove-http-encondings/345720
**Category:** Logstash
**Created:** [October 25, 2023, 11:12am UTC](https://discuss.elastic.co/t/remove-http-encondings/345720 "2023-10-25T11:12:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lemospt](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@lemospt](https://discuss.elastic.co/u/lemospt)
#### Post date: [October 25, 2023, 11:12am UTC](https://discuss.elastic.co/t/remove-http-encondings/345720/1 "2023-10-25T11:12:09Z")

</div>

Hi guys,

i'm integrating log from proxy squid, there is a field called 'Original Received Request Header' that has data like below,

User-Agent:%20git/2.30.2%0D%0AProxy-Connection:%20Keep-Alive%0D%0AHost:%[20github.private.com:443](http://20github.private.com:443/)%0D%0A

So basically i want to remove http encodings and get the following,

User-Agent:git/2.30.2  
Proxy-Connection:Keep-Alive  
Host:github.private.com:443

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [October 25, 2023, 12:38pm UTC](https://discuss.elastic.co/t/remove-http-encondings/345720/2 "2023-10-25T12:38:24Z")

</div>

```auto
filter {
   mutate{ gsub => ["message", "%0D|%0A|%20", ""] }
   grok { match => { "message" => "User-Agent:%{DATA:User-Agent}Proxy-Connection:%{DATA:Proxy-Connection}Host:%{GREEDYDATA:Host}" } }
}

```

```auto
{
          "User-Agent" => "git/2.30.2",
                "Host" => "github.private.com:443",
             "message" => "User-Agent:git/2.30.2Proxy-Connection:Keep-AliveHost:github.private.com:443",
    "Proxy-Connection" => "Keep-Alive"
}

```

---

<div class="post-metadata">

### Author: ![lemospt](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@lemospt](https://discuss.elastic.co/u/lemospt)
#### Post date: [October 25, 2023, 4:17pm UTC](https://discuss.elastic.co/t/remove-http-encondings/345720/3 "2023-10-25T16:17:43Z")

</div>

thanks @Rios, it's not the solution i use but you point me to the answer.

Let here what i implement,

mutate{ gsub =\> ["requestheader", "%20", ""] }  
mutate{ gsub =\> ["requestheader", "%0D|%0A", " "] }

kv {  
source =\> "requestheader"  
value\_split =\> ":"  
}

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [October 25, 2023, 5:03pm UTC](https://discuss.elastic.co/t/remove-http-encondings/345720/4 "2023-10-25T17:03:12Z")

</div>

Yes, you can use KV filer. For gsub just need to be tested, which is better for your case.

---

<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: [November 22, 2023, 5:03pm UTC](https://discuss.elastic.co/t/remove-http-encondings/345720/5 "2023-11-22T17:03:33Z")

</div>

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