# To retrieve two particular values from logstash and perform mathematical operation

**URL:** <https://discuss.elastic.co/t/to-retrieve-two-particular-values-from-logstash-and-perform-mathematical-operation/101286>\
**Category:** Logstash\
**Created:** [September 21, 2017, 8:32am UTC](https://discuss.elastic.co/t/to-retrieve-two-particular-values-from-logstash-and-perform-mathematical-operation/101286 "2017-09-21T08:32:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RASHMI\_S](https://avatars.discourse-cdn.com/v4/letter/r/6bbea6/32.png) [@RASHMI\_S](https://discuss.elastic.co/u/RASHMI_S)\
**Post date:** [September 21, 2017, 8:32am UTC](https://discuss.elastic.co/t/to-retrieve-two-particular-values-from-logstash-and-perform-mathematical-operation/101286/1 "2017-09-21T08:32:30Z")

</div>

{"xn":"CSI\_IUCPBySL","var":"DEFAULT","c":"olpv081040817257150214","x":"olpv081040817257150214","xst":"20170914T150218.840","xet":"20170914T150218.936","in":{"CallID":"olpv081040817257150214","SearchBy":"TN","TNorBAN":"4046307783"}

This is the log ,I need to retrieve the values xet(End Time) and xst(Start Time) alone and subtract xst from xet to get the duration,can I do this usuing grok

---

<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 24, 2017, 8:19pm UTC](https://discuss.elastic.co/t/to-retrieve-two-particular-values-from-logstash-and-perform-mathematical-operation/101286/2 "2017-09-24T20:19:50Z")

</div>

You can use grok but it's better to use a json filter (or possibly a json codec).

---

<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 22, 2017, 8:20pm UTC](https://discuss.elastic.co/t/to-retrieve-two-particular-values-from-logstash-and-perform-mathematical-operation/101286/3 "2017-10-22T20:20:20Z")

</div>

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