# Newbie mutate filter failure

**URL:** <https://discuss.elastic.co/t/newbie-mutate-filter-failure/71550>\
**Category:** Logstash\
**Created:** [January 13, 2017, 5:16pm UTC](https://discuss.elastic.co/t/newbie-mutate-filter-failure/71550 "2017-01-13T17:16:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhooper](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mhooper](https://discuss.elastic.co/u/mhooper)\
**Post date:** [January 13, 2017, 5:16pm UTC](https://discuss.elastic.co/t/newbie-mutate-filter-failure/71550/1 "2017-01-13T17:16:35Z")

</div>

t source /mnt/logs/core1ui1/Log\_2017-01-13-12.log

My message gets inserted as above. I would like to add a tag (or a field) that tells me that source contained core1ui1. My current filter is as below but I have got neither a tag (nor a field) when it executes.

if [source] =~ /core1ui1/ {  
mutate {  
add\_tag =\> ["WebService"]  
#add\_field =\> { "service" =\> "WebService" }  
}  
}  
thank you

---

<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:** [January 16, 2017, 7:15am UTC](https://discuss.elastic.co/t/newbie-mutate-filter-failure/71550/2 "2017-01-16T07:15:28Z")

</div>

> ```
> if [source] =~ /core1ui1/ {
> 
> ```

Unless your field name really has leading and trailing space make this:

```
if [source] =~ /core1ui1/ {

```

---

<div class="post-metadata">

**Author:** ![mhooper](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mhooper](https://discuss.elastic.co/u/mhooper)\
**Post date:** [January 17, 2017, 4:01pm UTC](https://discuss.elastic.co/t/newbie-mutate-filter-failure/71550/3 "2017-01-17T16:01:40Z")

</div>

thank you, that was the problem. much appreciated.

---

<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 14, 2017, 4:01pm UTC](https://discuss.elastic.co/t/newbie-mutate-filter-failure/71550/4 "2017-02-14T16:01:46Z")

</div>

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