# Mutate under conditional statement is not working. any suggestion please

**URL:** <https://discuss.elastic.co/t/mutate-under-conditional-statement-is-not-working-any-suggestion-please/99225>\
**Category:** Logstash\
**Created:** [September 3, 2017, 2:50pm UTC](https://discuss.elastic.co/t/mutate-under-conditional-statement-is-not-working-any-suggestion-please/99225 "2017-09-03T14:50:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smeka](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@smeka](https://discuss.elastic.co/u/smeka)\
**Post date:** [September 3, 2017, 2:50pm UTC](https://discuss.elastic.co/t/mutate-under-conditional-statement-is-not-working-any-suggestion-please/99225/1 "2017-09-03T14:50:20Z")

</div>

Hi,  
Need some help please.

path =\> ["/var/log/jbossas/domain/server1/server.log", "/var/log/jbossas/domain/server2/server.log"]

in filter portion i used the below to create a directory to write the log file to central logging server.

grok {  
match =\> [  
"path" , "/%{WORD:jboss\_profile/}/"  
]  
}  
if [jboss\_profile] == "server1" {  
mutate { add\_field =\> { "appname" =\> "server1" } }  
mutate { add\_filed =\> { "profile\_group" =\> "%{appname}"}  
}  
if [jboss\_profile] == "server2" {  
mutate { add\_field =\> { "appname" =\> "server2 }}  
mutate { add\_filed =\> { "profile\_group" =\> "%{appname}"}  
}

Thanks

---

<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:** [September 4, 2017, 5:30am UTC](https://discuss.elastic.co/t/mutate-under-conditional-statement-is-not-working-any-suggestion-please/99225/2 "2017-09-04T05:30:58Z")

</div>

Is the grok filter successfully extracting a `jboss_profile` field?

---

<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:** [October 2, 2017, 5:30am UTC](https://discuss.elastic.co/t/mutate-under-conditional-statement-is-not-working-any-suggestion-please/99225/3 "2017-10-02T05:30:58Z")

</div>

Closed on October 2, 2017, 5:30am UTC

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