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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...