Dashboards & Visualizations

Reusing panels in multiple dashboards - How to modify a prebuilt panel?

ashean
Engager

I'd like to reuse dashboard panels across multiple dashboards, and I would ideally be able to maintain the search logic for the panels in one place rather than having the logic duplicated.

I tried to achieve this using prebuilt panels, but I can't work out how to modify an existing prebuilt panel. It seems like once they are created they can't be changed, which defeats the purpose for me.

I also tried to achieve this by using panels based on reports. This also didn't work for me because my panels take inputs from the dashboard (for example, which hosts to search), but it seems like reports need to be based on a static search string.

I'm running Splunk Version 6.2.6

Any ideas?

1 Solution

tormodbp
Path Finder

I believe that what you are looking for is savedsearch, which you kind of touch with your third example.

Saved searches can be created two ways, either through the interface(Settings -> Searches, reports, and alerts -> New) or by editing(or creating) a savedsearch.conf in the apps directory( ..\etc\<app>\local\savedsearch.conf).

To include the variable names in the saved search you have to specify a placeholder variable:

index=test sourcetype=<my-sourcetype> host=$my-variable$ .....

When wanting to use the savedsearch in a panel, specify the search string for the panel like this:

| savedsearch <my-saved-search> my-variable=<my-input-token>

Now you should be able to use the same search string in all the dashboards and only have to edit the main search string one place.


Here is an example of a minimal savedsearch.conf for the saved search test:

[test]
description = A minimal test example of savedsearch with variable
search = index=* sourcetype=test | extract pairdelim="; " kvdelim=":"  | search user=$my-variable$

Cheers,

View solution in original post

0 Karma

tormodbp
Path Finder

I believe that what you are looking for is savedsearch, which you kind of touch with your third example.

Saved searches can be created two ways, either through the interface(Settings -> Searches, reports, and alerts -> New) or by editing(or creating) a savedsearch.conf in the apps directory( ..\etc\<app>\local\savedsearch.conf).

To include the variable names in the saved search you have to specify a placeholder variable:

index=test sourcetype=<my-sourcetype> host=$my-variable$ .....

When wanting to use the savedsearch in a panel, specify the search string for the panel like this:

| savedsearch <my-saved-search> my-variable=<my-input-token>

Now you should be able to use the same search string in all the dashboards and only have to edit the main search string one place.


Here is an example of a minimal savedsearch.conf for the saved search test:

[test]
description = A minimal test example of savedsearch with variable
search = index=* sourcetype=test | extract pairdelim="; " kvdelim=":"  | search user=$my-variable$

Cheers,

0 Karma

ashean
Engager

Thanks, that works well. By using saved searches inside prebuilt panels I get both the easy portability and ability to centrally manage the search logic.

0 Karma

tormodbp
Path Finder

If you need specialized panels, remember that you can use the saved search as a "base search" and do other more intricate searches "on top" of it. Its is also quite easy to combine several saved searches with append or similar commands.

Glad i could help!

0 Karma

santosh_sshanbh
Path Finder

If I want to pass dynamic value to a panel like Panel Title, chart header etc. within the panel then how can I pass the parameters to a prebuilt panel?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...