# KV trim\_key or remove\_char\_key

**URL:** https://discuss.elastic.co/t/kv-trim-key-or-remove-char-key/104304
**Category:** Logstash
**Created:** [October 17, 2017, 8:23pm UTC](https://discuss.elastic.co/t/kv-trim-key-or-remove-char-key/104304 "2017-10-17T20:23:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ctaroco](https://avatars.discourse-cdn.com/v4/letter/c/e19b73/32.png) [@ctaroco](https://discuss.elastic.co/u/ctaroco)
#### Post date: [October 17, 2017, 8:23pm UTC](https://discuss.elastic.co/t/kv-trim-key-or-remove-char-key/104304/1 "2017-10-17T20:23:33Z")

</div>

Hi,

I'm receiving syslogs from different equipment with quite different formats, but every log always starts with something like this:

\<188\>time=..... or \<177\>id=.....

So, each time that I apply kv, I got a field named like: \<188\>time, \<187\>time and so on.

I would like to trim o remove this part of the field, but a couldn't find a way to write in the conf file an expression to solved it. The result always is that only the first "\<" get removed.

Any thoughts?

---

<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: [October 18, 2017, 5:19am UTC](https://discuss.elastic.co/t/kv-trim-key-or-remove-char-key/104304/2 "2017-10-18T05:19:42Z")

</div>

Use a grok filter to preprocess each log line and extract everything that comes after the prefix to a new field that you feed to kv. Or, use a mutate filter's gsub option to replace the prefix with an empty string.

---

<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: [November 15, 2017, 5:20am UTC](https://discuss.elastic.co/t/kv-trim-key-or-remove-char-key/104304/3 "2017-11-15T05:20:08Z")

</div>

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