DEV Community

Maxime Guilbert
Maxime Guilbert

Posted on • Edited on

3 3

Splunk - Dashboard request optimization

Creating a dashboard in Splunk can be really heavy and long to load if it's not optimized.

The biggest part of the optimization is the reusage of requests.

To do it easily, Splunk implemented a search object which can be use as basis for other requests.

<search id="baseSearch">
    <query>$env$ $project$ action=$action$  $typeCode_tok$
    | table timestamp, etransferId, application.name, context, action, correlationId,dd.trace_id, error.code, error.text, log, _raw 
    | sort timestamp $sort$, time $sort$
    </query>
    <earliest>$time.earliest$</earliest>
    <latest>$time.latest$</latest>
</search>
Enter fullscreen mode Exit fullscreen mode

Like this, a big part is already loaded and you just have to refine some elements for a particular graph.

<search id="baseSearch">
    <query>$env$ $project$ action=$action$  $typeCode_tok$
    | table timestamp, etransferId, application.name, context, action, correlationId,dd.trace_id, error.code, error.text, log, _raw 
    </query>
    <earliest>$time.earliest$</earliest>
    <latest>$time.latest$</latest>
  </search>

  <search id="baseSearchLatest" base="baseSearch">
    <query>search 
    | stats latest() by dd.trace_id 
    | rename latest(error.code) AS error.code | fillnull value="emptyVal" error.code
    | rename latest(action) AS action | fillnull value="null" action
    | rename latest(error.text) AS error.text
    </query>
  </search>
Enter fullscreen mode Exit fullscreen mode

I hope it will help you! 🍺


You want to support me?

Buy Me A Coffee

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay