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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...