# Extract multiple field/value pairs from single value in JSON string

**URL:** <https://discuss.elastic.co/t/extract-multiple-field-value-pairs-from-single-value-in-json-string/217367>\
**Category:** Logstash\
**Created:** [January 31, 2020, 12:25pm UTC](https://discuss.elastic.co/t/extract-multiple-field-value-pairs-from-single-value-in-json-string/217367 "2020-01-31T12:25:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adi\_Buta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adi_buta/32/45475_2.png) [@Adi\_Buta](https://discuss.elastic.co/u/Adi_Buta)\
**Post date:** [January 31, 2020, 12:25pm UTC](https://discuss.elastic.co/t/extract-multiple-field-value-pairs-from-single-value-in-json-string/217367/1 "2020-01-31T12:25:24Z")

</div>

Hello,  
I'm trying to extract some field/value pairs from a single field in a json string. My sample message:  
{  
...  
"comment":"Ticket number : INC:I16393898, status : Work In Progress, group : Ent.Support.SOC.",  
...  
}

From the value of the "comment" field I would like to extract three separate field/value pairs:  
"Ticket number":"INC:I16393898"  
"status":"Work In Progress"  
"group":"Ent.Support.SOC."

What I tried and miserably failed:  
filter {  
mutate {  
add\_field =\> { "cmt\_ticket\_no" =\> "%{[comment][Ticket number]}" }  
add\_field =\> { "cmt\_status" =\> "%{[comment][status]}" }  
add\_field =\> { "cmt\_group" =\> "%{[comment][group]}" }  
}}  
Is there a solution for what I try to achieve? Any suggestion is highly appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![ITIC](https://avatars.discourse-cdn.com/v4/letter/i/90ced4/32.png) [@ITIC](https://discuss.elastic.co/u/ITIC)\
**Post date:** [January 31, 2020, 1:28pm UTC](https://discuss.elastic.co/t/extract-multiple-field-value-pairs-from-single-value-in-json-string/217367/2 "2020-01-31T13:28:22Z")

</div>

Hi

Take a look at the `kv{}` filter [here](https://www.elastic.co/guide/en/logstash/current/plugins-filters-kv.html).

I think you can easily extract what you need using `source` and `field_split` or `field_split_pattern` in the `kv{}`filter.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Adi\_Buta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adi_buta/32/45475_2.png) [@Adi\_Buta](https://discuss.elastic.co/u/Adi_Buta)\
**Post date:** [January 31, 2020, 3:11pm UTC](https://discuss.elastic.co/t/extract-multiple-field-value-pairs-from-single-value-in-json-string/217367/3 "2020-01-31T15:11:22Z")

</div>

It did work indeed, many thanks

---

<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 28, 2020, 3:11pm UTC](https://discuss.elastic.co/t/extract-multiple-field-value-pairs-from-single-value-in-json-string/217367/4 "2020-02-28T15:11:23Z")

</div>

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