Dashboards & Visualizations

JSChart with Post Process

matthewcanty
Communicator

Could someone give a simple example of how to use Post Process with JSChart?

I want a base search of index=daldev

Then two charts, the first:
timechart per_second(A) by Action

second:
timechart per_second(B) by Action

Tags (1)
1 Solution

sideview
SplunkTrust
SplunkTrust

Well at the simplest level, you can use those exact searches, but you have to sneak in a

| fields A B Action _time 

onto the end in order for the base search to run the field extractions for A and B. Unless it sees evidence that a given field is necessary for the base search, Splunk wont extract it and therefore it wont exist come post-process time.

However it's not best-practice to use postprocess in situations where the base search is a simple search for events. Instead you use stats and as necessary the bin command to make a base search that is itself a transforming search. This results in better performance and avoids some scaling problems.

Let's say the final granularity of your timecharts is such that one bucket equals one hour.

base search:

index=daldev | bin _time span=1h | stats sum(A) as A sum(B) as B count by _time Action

postprocess 1:

timechart per_second(A) by Action

postprocess 2:

timechart per_second(B) by Action

View solution in original post

sideview
SplunkTrust
SplunkTrust

Well at the simplest level, you can use those exact searches, but you have to sneak in a

| fields A B Action _time 

onto the end in order for the base search to run the field extractions for A and B. Unless it sees evidence that a given field is necessary for the base search, Splunk wont extract it and therefore it wont exist come post-process time.

However it's not best-practice to use postprocess in situations where the base search is a simple search for events. Instead you use stats and as necessary the bin command to make a base search that is itself a transforming search. This results in better performance and avoids some scaling problems.

Let's say the final granularity of your timecharts is such that one bucket equals one hour.

base search:

index=daldev | bin _time span=1h | stats sum(A) as A sum(B) as B count by _time Action

postprocess 1:

timechart per_second(A) by Action

postprocess 2:

timechart per_second(B) by Action
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...