Splunk Search

Best practice for post-process searches with a timechart base search?

Graham_Hanningt
Builder

I have a Splunk Enterprise 6.4 dashboard that displays multiple timecharts, all based on the same events in the same time range.

When I first developed this dashboard, each chart had its own self-contained search string. I recently edited the dashboard to use the following base search:

<search id="base_timechart">
  <query>sourcetype=my_log_type $blacklist$ $tran$ $response$ | timechart avg(response) sum(usercpu) avg(dispatch) avg(suspend) avg(syncproc) avg(rmielap) avg(fcwait) avg(jcwait) avg(pcstghwm) avg(tdwait)</query>
</search>

(The tokens are set by user interface controls.)

Here is an example chart search in the updated dashboard:

<search base="base_timechart">
  <query>fields _time avg(response)</query>
</search>

That is, I'm using the fields command to pick a series from the results of the timechartin the base search (for some charts, I pick more than one series).

This works for me, but I thought I'd ask (after searching for existing related questions here and Googling for information elsewhere): is this best practice, or is there a better way?

1 Solution

somesoni2
Revered Legend

I'm using fields OR table command in my similar post-process searches. Can't think of any issues or better way than this. Only other thing that I do is the rename columns in the timechart to something user friendly.

View solution in original post

somesoni2
Revered Legend

I'm using fields OR table command in my similar post-process searches. Can't think of any issues or better way than this. Only other thing that I do is the rename columns in the timechart to something user friendly.

Graham_Hanningt
Builder

Thanks, @somesoni2!

Yeah, I rename series in charts that display a legend. For single-series charts, I typically don't bother (renaming or displaying a legend).

If you can convert your comment to an answer, I'm happy to accept it. It's very useful for me to get feedback here on what I'm doing as I'm learning Splunk, especially from someone with high karma points (which I'm roughly equating to "experience"). Thanks again.

ppablo
Retired

Just converted @somesoni2's comment to an answer for you to accept @Graham_Hannington 🙂 cheers!

Patrick

0 Karma

Graham_Hanningt
Builder

Thanks for converting the comment, Patrick 🙂

0 Karma

ppablo
Retired

no problem 🙂

0 Karma
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!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...