# Logstash KV plugin working

**URL:** <https://discuss.elastic.co/t/logstash-kv-plugin-working/99338>\
**Category:** Logstash\
**Created:** [September 4, 2017, 5:10pm UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338 "2017-09-04T17:10:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 4, 2017, 5:10pm UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338/1 "2017-09-04T17:10:16Z")

</div>

Hi,

I am trying to use logstash's KV plugin. I have following log format:  
time taken for transfer for all files in seconds=23 transfer start time= 201708030959 transfer end time = 201708030959

My .conf file has following KV plugin:  
filter {   
kv {  
value\_split =\> "="  
}  
}

When I run logstash, it parses complete log file line by line excluding the one having "=". I need seconds, start time and end time to be separated as key value pairs. Please suggest.

---

<div class="post-metadata">

**Author:** ![inhinyera16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inhinyera16/32/61625_2.png) [@inhinyera16](https://discuss.elastic.co/u/inhinyera16)\
**Post date:** [September 5, 2017, 3:31am UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338/2 "2017-09-05T03:31:07Z")

</div>

I have used kv as well, and what i did is, i used mutate gsub the key into one word  
example :  
Here, i remove all the spaces, so that it will become key=value  
transfer start time = transfer\_start\_time  
transfer end time = transfer\_end\_time

then do kv filter.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 5, 2017, 3:29pm UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338/3 "2017-09-05T15:29:26Z")

</div>

Thanks, I will try this.

---

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 7, 2017, 2:35pm UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338/4 "2017-09-07T14:35:36Z")

</div>

Hi,

I could parse all the data and could see that in Kibana. But for "time" key, it combines both the values in a single field. Like time = "201708030959 ,201708030959". Which seems to be correct as per default implementation.

I need both the timings as separate fields like "start time = 201708030959" and "end time=201708030959". So, that I can use them separately. You mentioned to use gsub to make new field from available one. Can you please show how exactly we can do that?

Thanks,

---

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 12, 2017, 4:55pm UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338/5 "2017-09-12T16:55:50Z")

</div>

Hi,

Can you please provide an example of it to combine the field?

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:** [October 10, 2017, 4:55pm UTC](https://discuss.elastic.co/t/logstash-kv-plugin-working/99338/6 "2017-10-10T16:55:57Z")

</div>

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