# Mutate field is not executing?

**URL:** <https://discuss.elastic.co/t/mutate-field-is-not-executing/71610>\
**Category:** Logstash\
**Created:** [January 14, 2017, 1:37pm UTC](https://discuss.elastic.co/t/mutate-field-is-not-executing/71610 "2017-01-14T13:37:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)\
**Post date:** [January 14, 2017, 1:37pm UTC](https://discuss.elastic.co/t/mutate-field-is-not-executing/71610/1 "2017-01-14T13:37:12Z")

</div>

Hi,

I have a config file which is used to get the slowlogs .And in that i want only the queries content in the source\_body .

Can anyone help me how to acheive this?

input {  
file {  
path =\> "F:\elasticsearch-2.4.0\elasticsearch-2.4.0\logs\elasticsearch\_index\_search\_slowlog.log"  
start\_position =\> "beginning"  
}  
}

filter {  
grok { # parses the common bits  
match =\> ["message", "[%{TIMESTAMP\_ISO8601:TIMESTAMP}][%{LOGLEVEL:LEVEL}%{SPACE}][%{DATA:QUERY}]%{SPACE}[%{DATA:QUERY1}]%{SPACE}[%{DATA:INDEX-NAME}][%{DATA:SHARD}]%{SPACE}took[%{DATA:TOOK}],%{SPACE}took\_millis[%{DATA:TOOKM}], types[%{DATA:types}], stats[%{DATA:stats}], search\_type[%{DATA:search\_type}], total\_shards[%{NUMBER:total\_shards}], source[%{DATA:source\_query}], extra\_source[%{DATA:extra\_source}],"]  
}  
mutate {  
gsub =\> [  
"source", "], extra\_source[$", ""  
]  
}  
}

output {  
stdout { codec =\> rubydebug }  
}

My output is like this:

```
"total_shards" => "5",
       "types" => "details",
       "LEVEL" => "WARN",
     "message" => "[2017-01-14 10:59:58,593][WARN][index.search.slowlog.query] [yaswanth] [bank][1] took[52.2ms], took_millis[52], types[details], stats[], search_type[QUERY_THEN_FETCH], total_shards[5], source[{\"sort\":[{\"balance\":{\"order\":\"asc\"}}]}], extra_source[], \r",
       "SHARD" => "1",
 "search_type" => "QUERY_THEN_FETCH",
        "tags" => [],
      "QUERY1" => "yaswanth",
        "TOOK" => "52.2ms",
        "path" => "F:\\elasticsearch-2.4.0\\elasticsearch-2.4.0\\logs\\elasticsearch_index_search_slowlog.log",
       "TOOKM" => "52",
"source_query" => "{\"sort\":[{\"balance\":{\"order\":\"asc\"}}]}",
  "@timestamp" => 2017-01-14T13:27:16.685Z,
  "INDEX-NAME" => "bank",
       "QUERY" => "index.search.slowlog.query",
   "TIMESTAMP" => "2017-01-14 10:59:58,593",
    "@version" => "1",
        "host" => "yaswanth"

```

And i also wanted to remove the quotations(i.e instead of "host"=\>"yaswanth" i want host=\>yaswanth

Any help can be highly appreciated?

---

<div class="post-metadata">

**Author:** ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)\
**Post date:** [January 15, 2017, 2:35pm UTC](https://discuss.elastic.co/t/mutate-field-is-not-executing/71610/2 "2017-01-15T14:35:34Z")

</div>

@magnusbaeck Can you help me in solving this?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 16, 2017, 2:59am UTC](https://discuss.elastic.co/t/mutate-field-is-not-executing/71610/3 "2017-01-16T02:59:57Z")

</div>

Please don't ping people like that, and have patience 🙂

---

<div class="post-metadata">

**Author:** ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)\
**Post date:** [January 16, 2017, 3:33am UTC](https://discuss.elastic.co/t/mutate-field-is-not-executing/71610/4 "2017-01-16T03:33:50Z")

</div>

sorry..

---

<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 13, 2017, 3:33am UTC](https://discuss.elastic.co/t/mutate-field-is-not-executing/71610/5 "2017-02-13T03:33:50Z")

</div>

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