# LogstashのKVフィルター設定について

**URL:** <https://discuss.elastic.co/t/logstash-kv/290528>\
**Category:** 日本語による質問・議論はこちら\
**Created:** [November 30, 2021, 9:01am UTC](https://discuss.elastic.co/t/logstash-kv/290528 "2021-11-30T09:01:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tsgkdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsgkdt/32/39151_2.png) [@tsgkdt](https://discuss.elastic.co/u/tsgkdt)\
**Post date:** [November 30, 2021, 3:22pm UTC](https://discuss.elastic.co/t/logstash-kv/290528/2 "2021-11-30T15:22:36Z")

</div>

似たような投稿をつい先日も見た気がしますが、  
こちらが参考になるのではないでしょうか。

> [@Kv filter with spaces in values](https://discuss.elastic.co/t/kv-filter-with-spaces-in-values/227962):
>
> Hello, I've got a log that seems a perfect candidate for the kv filter: msg=Start MID 1242272 ICID 1632662 categorySignificance=/Informational catdt=Web Filtering categoryObject=/Host/Application/Service deviceSeverity=Info rt=1582506453000 and so on ... but, as you can see, there are values that contain space(s). The first field, for example, is msg and should contain Start MID 1242272 ICID 1632662, but the filter simply stops at the first space, as for the catdt field, giving: { …

kvで処理する前に、mutateのgsubで区切り文字を違う文字にすることで、kvで処理しやすくしています。上記のリンク先の例では、区切り文字としてカンマを指定しています。

> key3=value3 key4=val ue4 key5=value5 key6=val ue6

↓ mutate/gsubで 区切り文字を追加してやる

> key3=value3 , key4=val ue4 , key5=value5 , key6=val ue6

ここまで処理できれば、あとはkvで処理できるかと思います。

---

_[View the full topic](https://discuss.elastic.co/t/logstash-kv/290528)._
