Splunk Search

Problems with adding multi-value field through /var/spool/splunk

orpiczy
Splunk Employee
Splunk Employee

Hi Fellow Splunkers,
How can I add multi-value field (array) directly to the index through `/var/spool/splunk`.
I tried multiple approaches:

1. Dict
==##~~##~~ 1E8N3D4E6V5E7N2T9 ~~##~~##==
{ "array_field":["1", "2"], "count": "2", ... }

2. Classic
==##~~##~~ 1E8N3D4E6V5E7N2T9 ~~##~~##==
... , array_field=["1", "2"], count="2", ... 

I achieved best results with Dict approach. Added field correctly has multiple values, however ... to key ("array_field") splunk adds {}, resulting in incorrect key ("array_field{}")

Do you have any suggestions?

Labels (2)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

You will need some compromise one way or another.  Any specific reason why array_field{} is unacceptable?  If anything, you can use field alias to allow use of array_field.  Alternatively you can use calculated field to alter a key-value entry ("classic"), e.g., comma_delimited_field="1,2", then use split to calculate array_field.

0 Karma
Get Updates on the Splunk Community!

Pro Tips for First-Time .conf Attendees: Advice from SplunkTrust

Heading to your first .Conf? You’re in for an unforgettable ride — learning, networking, swag collecting, ...

Raise Your Skills at the .conf25 Builder Bar: Your Splunk Developer Destination

Calling all Splunk developers, custom SPL builders, dashboarders, and Splunkbase app creators – the Builder ...

Hunt Smarter, Not Harder: Discover New SPL “Recipes” in Our Threat Hunting Webinar

Are you ready to take your threat hunting skills to the next level? As Splunk community members, you know the ...