# Remove hashtags "#" using gsub

**URL:** <https://discuss.elastic.co/t/remove-hashtags-using-gsub/282028>\
**Category:** Logstash\
**Created:** [August 20, 2021, 3:48am UTC](https://discuss.elastic.co/t/remove-hashtags-using-gsub/282028 "2021-08-20T03:48:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mario\_kazela](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_kazela/32/124314_2.png) [@mario\_kazela](https://discuss.elastic.co/u/mario_kazela)\
**Post date:** [August 20, 2021, 3:48am UTC](https://discuss.elastic.co/t/remove-hashtags-using-gsub/282028/1 "2021-08-20T03:48:48Z")

</div>

Hi, I have some trouble using gsub on logstash because I'm still new on logstash configuration. Just want to asking. Example I have data like "#ynwa". How to remove "#" and leave the word "ynwa" only using gsub ?

mutate {  
gsub =\> ["query", "#", ""]  
}

Did I do the right command for remove the hashtags "#" using gsub on the conf file?

---

<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:** [August 20, 2021, 3:51am UTC](https://discuss.elastic.co/t/remove-hashtags-using-gsub/282028/2 "2021-08-20T03:51:03Z")

</div>

If the [query] field contains a # then I would expect that to remove it in logstash.

---

<div class="post-metadata">

**Author:** ![mario\_kazela](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_kazela/32/124314_2.png) [@mario\_kazela](https://discuss.elastic.co/u/mario_kazela)\
**Post date:** [August 20, 2021, 3:53am UTC](https://discuss.elastic.co/t/remove-hashtags-using-gsub/282028/3 "2021-08-20T03:53:02Z")

</div>

Yes the [query] field contains a #. So I did the right command, right?

---

<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:** [September 17, 2021, 3:53am UTC](https://discuss.elastic.co/t/remove-hashtags-using-gsub/282028/4 "2021-09-17T03:53:39Z")

</div>

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