Splunk Search

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

jawahir007
Path Finder

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

Labels (1)
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
Communicator

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
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...