Splunk Search

How do I create a table lookup to have multi line columns

jsburt
New Member

I have a table lookup to map product numbers to more-readable and usable names.

I would like to be able to map number 272829 to "Joes Widget (round blue)" - where the parenthesized part shows underneath "Joes Widget" in the resultant table.

Is this doable?

What would the string in the CSV file look like?

Thanks

0 Karma

niketn
Legend

@jsburt could you please add more details on what is (round blue) and why do you need it below "Jows Widget"? Can you add a mock up screenshot of what you need? Also what is the current query that you have?

Once you show the result in the table, is there drilldown configured or is it just for display?

If you create lookup like the following:

number    details
272829    Joes Widget,(round blue)

Or

number    name          tag
272829    Joes Widget   (round blue)

You can still use SPL commands to format output fields to create multivalue results in your table i.e. split() evaluation function or makemv command on details field for first lookup and mvappend, mvjoin command for second lookup.

As requested earlier, for us to assist you better you would need to provide more details on what you current have and what is it exactly that you want (also why you want as well as it will add context to your question).

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

woodcock
Esteemed Legend

You can do this but only by making that field a multi-valued field where each line is another value (you can use rex mode=sed ... | makemv delim=... and many other commands for this). The problem with this is that when you write it out to file-based csv/lookup, Splunk implicitly calls nomv on every field to flatten out each multi-valued field. So you have 3 options:

1: Use a KV-Store based lookup; these support`multi-valued` fields.
2: Encode your `multi-valued` on write ( `mvcombine delim=":::"` ), and decode it on read ( `makemv delim=":::"` ).
3: Expand your  `multi-valued` row on write ( `mvexpand` ), and merge on read ( `stats values(*) AS * BY key_field` ).
0 Karma

CarsonZa
Contributor

If you don't want to change your lookup from its current form try this. My regex may need some tweaking.

| inputlookup test.csv
| rex field=Name "(?<\FieldA>.)\s((?<\FieldB>.))"
| eval combined=mvappend(FieldA,FieldB)
| fields - FieldA, FieldB

Otherwise you can simply add some type of "delimiter" to separate the two pieces like so "Joes Widget - (round blue)". Then in your search | makemv productName delim="-"

Either one of those should display the table i believe you are describing. Leaving your lookup as single line.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...