Splunk Search

Dowloading results of table to .csv file

smanojkumar
Contributor

Hello Splunkers,

    I'm getting proper results without any selction in input dropdown, I can able to download the results of that particular table but when I'm making any selection in dahsboard, since its having the base search, its loading results will all fields in base search rather than the fields mentioned in that table.

here is the query,

<panel>
<title>Raw Data</title>
<!-- HTML Panel for Spinner -->
<input type="text" token="value" searchWhenChanged="true">
<label>Row Data per Page</label>
<default>20</default>
<initialValue>20</initialValue>
</input>
<input type="radio" token="field3" searchWhenChanged="true">
<label>Condition_1</label>
<choice value="=">Contains</choice>
<choice value="!=">Does Not Contain</choice>
<default>=</default>
<initialValue>=</initialValue>
</input>
<input type="text" token="search" searchWhenChanged="true">
<label>All Fields Search_1</label>
<default>*</default>
<initialValue>*</initialValue>
<prefix>"*</prefix>
<suffix>*"</suffix>
</input>
<input type="checkbox" token="field4">
<label>Add New Condition</label>
<choice value="0">Yes</choice>
</input>
<input type="dropdown" token="field5" searchWhenChanged="true" depends="$field4$">
<label>Expression</label>
<choice value="AND">AND</choice>
<choice value="OR">OR</choice>
<default>AND</default>
<initialValue>AND</initialValue>
</input>
<input type="radio" token="field6" searchWhenChanged="true" depends="$field4$">
<label>Condition_2</label>
<choice value="=">Contains</choice>
<choice value="!=">Does Not Contain</choice>
<default>=</default>
<initialValue>=</initialValue>
</input>
<input type="text" token="search2" searchWhenChanged="true" depends="$field4$">
<label>All Fields Search_2</label>
<default>*</default>
<initialValue>*</initialValue>
<prefix>"*</prefix>
<suffix>*"</suffix>
</input>
<html>
<a class="btn btn-primary" role="button" href="/api/search/jobs/$export_sid$/results?isDownload=true&amp;timeFormat=%25FT%25T.%25Q%25%3Az&amp;maxLines=0&amp;count=0&amp;filename=Event_Logs&amp;outputMode=csv">Download CSV</a>
</html>
<html depends="$showSpinner3$">
<!-- CSS Style to Create Spinner using animation -->
<style>
.loadSpinner {
margin: 0 auto;
border: 5px solid #FFF; /* White BG */
border-top: 5px solid #3863A0; /* Blue */
border-radius: 80%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
<!-- CSS override to hide default Splunk Search Progress Bar -->
#panel1 .progress-bar{
visibility: hidden;
}
</style>
<div class="loadSpinner"/>
</html>
<table>
<search base="base_search_index">
<progress>
<!-- Set the token to Show Spinner when the search is running -->
<set token="showSpinner3">true</set>
</progress>
<done>
<!-- Unset the token to Hide Spinner when the search completes -->
<unset token="showSpinner3"></unset>
</done>
<query>| sort _time |eval _raw=displayname.","._raw
| table _raw
| appendpipe
[| stats count
| where count == 0
| eval _raw="No Data Found for selected time and filters"
| table _raw ]</query>
<done>
<set token="export_sid">$job.sid$</set>
</done>
</search>
<option name="count">$value$</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
<format type="color" field="_raw">
<colorPalette type="map">{"No Data Found for selected time and filters":#D41F1F}</colorPalette>
</format>
</table>
</panel>
0 Karma

PaulPanther
Motivator

Only the dropdown input does not work or are you facing issues with all inputs? Have you checked if the inputs are passed correctly into the search?

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...