Hello,
I'm having a hard time creating a download button.
I have a scheduled report every day.
I would like to create a button in the dashbard that downloads that report.
I cannot use js.
Can you help me?
I found a way to download the query created but so I also view the table and I don't want to show it, just download the result.
Tks
Bye
Antonio
Below is the code for the button.
I solved
I ask the most skilled if this solution can fit
bye
Antonio
<search>
<query>| loadjob savedsearch="antonio:enterprise:Report"
</query>
<done>
<eval token="date">strftime(now(), "%d-%m-%Y")</eval>
<set token="file_name">Report</set>
<set token="sid">$job.sid$</set>
</done>
</search>
<html>
<BR/>
<div style="float: left">
<a href="/api/search/jobs/$sid$/results?isDownload=true&timeFormat=%25FT%25T.%25Q%25%3Az&maxLines=0&count=0&filename=$file_name$_$date$.csv&outputMode=csv" class="button js-button">Download Data</a>
</div>
<style>
Hi @antonio147,
I'm not an expert of HTML but I think that it isn't possible without using a JS.
As a workaround, you could use the standard "Export" button present in every panel.
Ciao.
Giuseppe
Hi Giuseppe,
I managed to create a download button for a table that I showed above without using js.
so :
<row>
<panel>
<table>
<search>
<done>
<eval token="date">strftime(now(), "%d-%m-%Y")</eval>
<set token="file_name">Tabella_Completa</set>
<set token="sid">$job.sid$</set>
</done>
<query>| loadjob savedsearch="antoino:enterprise:AGGREGATO_DATE"
|rename 00_MESE_PRECEDENTE as "MESE_ATTUALE"
</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">20</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html>
<a href="/api/search/jobs/$sid$/results?isDownload=true&timeFormat=%25FT%25T.%25Q%25%3Az&maxLines=0&count=0&filename=$file_name$_$date$.csv&outputMode=csv" class="button js-button">Estrai Pratiche</a>
<style>
.button {
background-color: steelblue;
border-radius: 5px;
color: white;
padding: .5em;
text-decoration: none;
}
.button:focus,
.button:hover {
background-color: #2A4E6C;
color: White;
}
</style>
</html>
</panel>
</row>
Now my need is to give the possibility to download a report that is in crontab on the Report panel.
I tried to insert it in a table and this is how it works but I can't put the table "hidden".
Also tried with the condition but it doesn't work.
Thanks for your answer
Antonio
Below is the code for the button.
I solved
I ask the most skilled if this solution can fit
bye
Antonio
<search>
<query>| loadjob savedsearch="antonio:enterprise:Report"
</query>
<done>
<eval token="date">strftime(now(), "%d-%m-%Y")</eval>
<set token="file_name">Report</set>
<set token="sid">$job.sid$</set>
</done>
</search>
<html>
<BR/>
<div style="float: left">
<a href="/api/search/jobs/$sid$/results?isDownload=true&timeFormat=%25FT%25T.%25Q%25%3Az&maxLines=0&count=0&filename=$file_name$_$date$.csv&outputMode=csv" class="button js-button">Download Data</a>
</div>
<style>
Hey,
Does anyone know what is the updated code for the v2 endpoint? I am trying to deploy apps with this config to Splunk Cloud but the vetting fails because new version of Splunk doesnt support old endpoint
I tried adapting the line of code for the button with the documentation, but it doesnt download anything and redirects to a 404 page.
Hi @splunksumman -
I’m a Community Moderator in the Splunk Community.
This question was posted 1 year ago, so it might not get the attention you need for your question to be answered. We recommend that you post a new question so that your issue can get the visibility it deserves. To increase your chances of getting help from the community, follow these guidelines in the Splunk Answers User Manual when creating your post.
Thank you!