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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...