# Extract a specific part of a kv filter

**URL:** <https://discuss.elastic.co/t/extract-a-specific-part-of-a-kv-filter/148021>\
**Category:** Logstash\
**Created:** [September 10, 2018, 9:22pm UTC](https://discuss.elastic.co/t/extract-a-specific-part-of-a-kv-filter/148021 "2018-09-10T21:22:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nilsb](https://avatars.discourse-cdn.com/v4/letter/n/b2d939/32.png) [@nilsb](https://discuss.elastic.co/u/nilsb)\
**Post date:** [September 10, 2018, 9:22pm UTC](https://discuss.elastic.co/t/extract-a-specific-part-of-a-kv-filter/148021/1 "2018-09-10T21:22:00Z")

</div>

Hi experts,  
I am trying to use kv filter but getting landed into a new problem. Surely no issue with filter, but my lack of knowledge 🙂

PFB the details:

**Problem statement:**

I am trying to parse an application log using kv filter. The separator within the log line is tilde "~". I am able to get the key-value pairs for the not-null fields, but the null fields are getting ignored by the filter.

**Example:**  
_ **Sample Logline:** _

2018-09-06 16:51:16.337 INFO (THREAD-438) system\_monitor : - LogTypeID=SAMPLELOG~RespCd=SAMPLE RESPONSE~MsgID=123456~HostNm=~SysTs=2018-09-06T16:51:16.312-07:00~AppID=SAMPLE~OrigCtyCd=~UPID=~PaySplitSeqNo=~AllocSeqNo=~AppServNmVr=Notify~PayTpChCd=~Amt=0~Curr=~SplitAmt=0~SplitCurr=~EventID="

**Observation:**  
The split is happening as follows:  
2018-09-06 16:51:16.337 INFO (THREAD-438) system\_monitor : - LogTypeID=SAMPLELOG  
RespCd=SAMPLE RESPONSE  
MsgID=123456

**Challenge:**  
As observed above, the split is happening as expected; but in the 1st line (with timestamps), I would like to only have the last string (LogTypeID) as the tag(no timestamps or Loglevel) . It should look something like:  
LogTypeID =\>SAMPLELOG

Please advise if there's a way to do this ? (split as per filter patter, and retain only a part of the new key, along with the value).

regards,  
Niladri

---

<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 8, 2018, 9:22pm UTC](https://discuss.elastic.co/t/extract-a-specific-part-of-a-kv-filter/148021/2 "2018-10-08T21:22:01Z")

</div>

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