- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I set up a flexible Splunk dashboard that responds to 4 custom input fields:
1. clientType (text)
2. region (text)
3. report window (dropdown)
4. refresh interval (dropdown)
My base query is:
<search id="baseSearch">
<query>index=myIndex $clientType$ region=$region$</query>
<earliest>$reportWindow.earliest$</earliest>
<latest>$reportWindow.latest$</latest>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
Now, I want to create a new panel in the form of a statistics table based on the `baseSearch` query:
<search base="baseSearch">
<query>search
| stats first(timestamp) as timestamp, first(applicationName) as applicationName, values(message) as message by entryKey
| table timestamp, entryKey, applicationName, message
</query>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
However, the Splunk panel shows "No Results found". Yet, when I press "Open in Search", the Splunk query looks correct, and I can see results in a table in Splunk search.
Why doesn't the statistics table in the Splunk panel get populated in the same way?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah sorry, it is <event> (not plural)
What are all the sections it is wrapped in? I may have a workaround but I don't know how it would interfere with your other XML
The workaround is to put a table into the base search, but leave the base search in a <event> section so that it saves the fields in the table, but does not display them as a table:
<search id="baseSearch">
<query>index=myIndex $clientType$ region=$region$ | table timestamp applicationName message entryKey</query>
<earliest>$reportWindow.earliest$</earliest>
<latest>$reportWindow.latest$</latest>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @jojopup123,
Did you try removing "search" term on your query?
<panel>
<table>
<title>Reference Events</title>
<search base="baseSearch">
<query>
| stats first(timestamp) as timestamp, first(applicationName) as applicationName, values(message) as message by entryKey
| table timestamp, entryKey, applicationName, message
</query>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the suggestion, but unfortunately it seems like nothing has changed.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you also post the base search XML, with sensitive information omitted?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's the base search:
<search id="baseSearch">
<query>index=myIndex $clientType$ region=$region$</query>
<earliest>$reportWindow.earliest$</earliest>
<latest>$reportWindow.latest$</latest>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
Here's an example of a (dummy) result you get if you "Open in Search" for the panel I was trying to create:
timestamp | entryKey | applicationName | message |
PST 2021-03-04 23:22:33,273 | JKHF96623JF | PaymentApp | Sent payment to... |
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the base search in an <events> xml section? The problem may be that the base search is doing a Fast search and not properly extracting the fields for the next search. When you press the "Open in Search" button, then Splunk combines the searches so that the baseSearch is required to find fields for the subsequent search.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, the search is not in an <events> section.
I just tried wrapping it like so:
<events>
<search id="baseSearch">
<query>index=myIndex $clientType$ region=$region$</query>
<earliest>$reportWindow.earliest$</earliest>
<latest>$reportWindow.latest$</latest>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
<events>
but the console complained - "Unknown node "events". Node "events" is not allowed here".
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah sorry, it is <event> (not plural)
What are all the sections it is wrapped in? I may have a workaround but I don't know how it would interfere with your other XML
The workaround is to put a table into the base search, but leave the base search in a <event> section so that it saves the fields in the table, but does not display them as a table:
<search id="baseSearch">
<query>index=myIndex $clientType$ region=$region$ | table timestamp applicationName message entryKey</query>
<earliest>$reportWindow.earliest$</earliest>
<latest>$reportWindow.latest$</latest>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The workaround works for the statistics table. However, I have to adjust the other panels' XML...can you explain why we have to have it in a table first? Thanks
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't say for sure without seeing your full dashboard XML, but I believe it is because you aren't using the right tags. Are you nesting the search in a <table>?
For example:
<dashboard>
<label>test_temp_delete_me</label>
<init>
<set token="clientType">something</set>
<set token="reportWindow.earliest">-1h</set>
<set token="reportWindow.latest">-5m</set>
<set token="refreshInterval">5m</set>
</init>
<row>
<panel>
<table>
<search id="baseSearch">
<query>|makeresults | eval clientType = $clientType$,eval timestamp=50, applicationName="someapp", message= "somemessage", entryKey="somekey"</query>
<earliest>$reportWindow.earliest$</earliest>
<latest>$reportWindow.latest$</latest>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
</table>
</panel>
<panel>
<table>
<search base="baseSearch">
<query> | stats first(timestamp) as timestamp, first(applicationName) as applicationName, values(message) as message by entryKey
| table timestamp, entryKey, applicationName, message
</query>
</search>
</table>
</panel>
</row>
</dashboard>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's the XML for my table:
<panel>
<table>
<title>Reference Events</title>
<search base="baseSearch">
<query>search
| stats first(timestamp) as timestamp, first(applicationName) as applicationName, values(message) as message by entryKey
| table timestamp, entryKey, applicationName, message
</query>
<refresh>$refreshInterval$</refresh>
<refreshType>delay</refreshType>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>
So it's nested in a <table>, yes
