# Unable to remove the field

**URL:** <https://discuss.elastic.co/t/unable-to-remove-the-field/26784>\
**Category:** Logstash\
**Created:** [August 4, 2015, 9:16am UTC](https://discuss.elastic.co/t/unable-to-remove-the-field/26784 "2015-08-04T09:16:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![soujanya](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@soujanya](https://discuss.elastic.co/u/soujanya)\
**Post date:** [August 4, 2015, 9:16am UTC](https://discuss.elastic.co/t/unable-to-remove-the-field/26784/1 "2015-08-04T09:16:50Z")

</div>

Hi all,  
I'm new to the Kibana. I'm trying to remove the field based on some condition. But not getting how to do..  
I've used the below code.

filter {  
grok {  
break\_on\_match =\> false  
match =\> { "message" =\> "%{TIMESTAMP\_ISO8601:timestamp}] %{LOGLEVEL:loglevel} %{GREEDYDATA:log}|%{GREEDYDATA:log1}"}  
}  
if[log] =~ "(?i) applicable" {  
grok{  
remove\_field =\> ["log"]  
}  
}  
}

If log contains keyword "applicable", log field has to be removed furtherly.Please anyone help me out in resolving the issue. Any help would greatly appreciated.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 4, 2015, 9:53am UTC](https://discuss.elastic.co/t/unable-to-remove-the-field/26784/2 "2015-08-04T09:53:52Z")

</div>

> ```
> if[log] =~ "(?i) applicable" {
> 
> ```

As documented, the correct syntax is:

```
if [log] =~ /(?i) applicable/ {

```

Secondly, the grok filter's remove\_field option will only fire when the grok filter is successful, and it never is because you're not supplying any expressions to match against. Use the mutate filter instead:

```
mutate {
  remove_field => ["log"]
}

```

---

<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:** [July 6, 2017, 5:33am UTC](https://discuss.elastic.co/t/unable-to-remove-the-field/26784/3 "2017-07-06T05:33:01Z")

</div>


