Splunk Enterprise

KV store lookup as array

arunssd
Loves-to-Learn

Hi 

 

I have a kv store lookup which populated automatically and it contains arrays . How can make it like a normal lookup that is searchable  or how to make it as a proper file 

 

current csv:

arunssd_0-1739878292623.png

 

 

I want the above kv store as a searchable lookup with proper segregation between each rows 

arunssd_0-1739878469721.png

 

 

Labels (1)
0 Karma

tscroggins
Influencer

Hi @arunssd,

If 1) your KV store collection uses array fields, 2) all field values have a 1:1:1:1 relationship, and 3) there are no empty/missing/null values within a field, i.e. all array values "line up":

asn                country    maliciousbehavior    riskscore
103.152.101.251 => PK      => 3                 => 9
103.96.75.159   => HK      => 3                 => 11
104.234.115.155 => CA      => 4                 => 9

you can transform the data with the transpose, mvexpand, and chart commands:

| inputlookup arunssd_kv
| transpose 0
| mvexpand "row 1"
| chart values("row 1") over _mkv_child by column
| fields - _mkv_child
| outputlookup arunssd_lookup.csv

However, your results may be truncated by mvexpand if the total size of the in-memory result is greater than the limits.conf max_mem_usage_mb setting (default: 500 MB). See https://docs.splunk.com/Documentation/Splunk/latest/Admin/Limitsconf#.5Bmvexpand.5D.

If this doesn't work for you, please share your collections.conf (KV store) and transforms.conf (lookup) settings. I used the following settings to test:

# collections.conf

[arunssd_kv]
field.asn = array
field.country = array
field.maliciousbehavior = array
field.riskscore = array

# transforms.conf

[arunssd_kv]
collection = arunssd_kv
external_type = kvstore
fields_list = asn,country,maliciousbehavior,riskscore

If your KV store fields are strings, the search can be adapted with the foreach and eval commands to coerce the fields values into a multi-valued type.

You can also transform the results from a shell using curl and jq or your scripting tools of choice.

0 Karma
Get Updates on the Splunk Community!

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...