Splunk Search

Table command versus stats command for this search (for efficiency)?

delgendy
Explorer

My Query is as follows
index=x source=y COMPLETED
| stats values(process_key) as "Process Key", values(process_start_time) as "Process Start Time", values(job_key) as "Job Key", latest(job_status) as "Job Status" latest(process_status) as "Process Status",values(total_run_duration) as "Process Duration", values(duration_process_inprogress) as "InProgress Duration", values(job_detail_lastupdate) as "Last Update Time" by process_key,process_name,job_detail_key
| rename process_name as "Process Name"
| table "Process Start Time", "Last Update Time", "Process Name", "Process Key", "Job Key" "Process Status" "Job Status" "Process Duration" "InProgress Duration"
| sort -"Process Start Time"
| fillnull "Process Duration" value=Opened

0 Karma

cmerriman
Super Champion

looking over your code, it looks pretty good. you can remove values(process_key) as "Process Key" since you are also using that in your by statement. You can use fields instead of table, if you're just using that to get them in the right order.

| stats values(process_start_time) as "Process Start Time", values(job_key) as "Job Key", latest(job_status) as "Job Status" latest(process_status) as "Process Status",values(total_run_duration) as "Process Duration", values(duration_process_inprogress) as "InProgress Duration", values(job_detail_lastupdate) as "Last Update Time" by process_key,process_name,job_detail_key 
| rename process_name as "Process Name" process_key as "Process Key"
0 Karma
Get Updates on the Splunk Community!

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 ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

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 ...