Splunk Search

Is there a way to get my saved search to sort the resulting table properly when run on my dashboard?

dolfantimmy
Path Finder

I am using a search cloned from the SoS app. I modified it to sort in the search itself. Though the search does run on my dashboard, it doesn't sort the table using the sort I have at the end of the saved search. Is there a way to specify the sort field in the simple XML?

0 Karma

vasanthmss
Motivator

Hi dolfantimmy,

Please ensure your search doesn't contains any macro's / eventtypes which is created by the SoS.

Most of the SoS application search string contains macro's those are with permission "in app" so probably you need to change the permission to global.

I tried locally its working fine. could you please share the exact query what you are cloned from SoS.

Cheers!
VaSu

V

dolfantimmy
Path Finder

Slightly modified from sos, here's the search. It run great in the search app. And does display data on my dashboard, but the data is not sorted when shown on the dashboard.


(host="sp3ctxqs01" OR splunk_server=local) action=search (id=* OR search_id=)
| eval search_id=if(isnull(search_id), id, search_id)
| replace '
' with * in search_id
| search search_id!=rt_* search_id!=searchparsetmp*
| rex "search='(?.?)', autojoin"
| rex "savedsearch_name=\"(?.
?)\"]["
| eval search=case(isnotnull(search),search,isnull(search) AND savedsearch_name!="","Scheduled search name : ".savedsearch_name,isnull(search) AND savedsearch_name=="","SID : ".search_id)
| convert num(total_run_time)
| eval user = if(user="n/a", "nobody", user)
| stats min(_time) as _time last(user) as user max(total_run_time) as total_run_time last(search) as search by search_id | search search_id=* search!=typeahead* search!="|history*" search!=_internal search!=_audit|sort -total_run_time

0 Karma

gfuente
Motivator

Is there a missing space between the minus sign and the field name?? Shouldn´t it be:

... |sort - total_run_time 
0 Karma

dolfantimmy
Path Finder

Thanks gfuente, I tried that with the same results. The dashboard still displays sorted by event time, not by total_run_time.

0 Karma

dolfantimmy
Path Finder

I meant to say I'm using a search cloned FROM the SoS app.

0 Karma

ppablo
Retired

Just edited it for ya @dolfantimmy You might want to include the search you're using and how you want the resulting table to display for search gurus to better assist you.

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...