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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...