Splunk Search

Is it possible to sort multi value field by word length?

jawahir007
Communicator

is it possible to sort multi-value field by word length...if yes then how to.

0 Karma

gaurav_maniar
Builder

Hi,
append the below code to your query,
If you want calculate the length of entire multi value field and than sort
...| eval mv_length = len(mv_field) | sort mv_length | fields - mv_length | ...

If you want to calculate the length of each value in multi-value field,
...| mvexpand mv_field | eval length = len(mv_field) | mvcombine mv_field delim="," | sort length |...

accept the answer if it helps.

becksyboy
Contributor

This alternative worked for me. Where I wanted to expand a multivalue field, show the length and search for one above a certain length value:

 

| mvexpand Logon_ID | eval length = len(Logon_ID)| search length >5

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...