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!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Your Voice Matters! Help Us Shape the New Splunk Lantern Experience

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Building Momentum: Splunk Developer Program at .conf25

At Splunk, developers are at the heart of innovation. That’s why this year at .conf25, we officially launched ...