Splunk Search

Splunk sort class not working with subsearch

Ranjeeth
New Member

With the below query I'm trying to sort dateTime by descending order but the sorting is not working, could someone please help me to identify the issue in the query .

 

hostname="alt*" [search "Starting Batch job" AND hostname="alt*" UUID=* | stats values(UUID) as uuid by UUID | fields UUID] | regex "JOB Execution*" |stats values(@timestamp) as dateTime,values(UUID) as uuid,values(message) as message | sort - dateTime | table dateTime, uuid, message

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your stats command as it stands returns a single row with 3 multi-value fields. If you want to be able to sort the dateTime field, you should separate it out into different rows, possibly by moving the values timestamp to a by clause

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...