Getting Data In

How to create an http link to directly download a Splunk search result as a CSV file when opened in a browser?

schece
New Member

Hello,

I am looking for a solution to download a Splunk-search-result as csv file, with a direct download link.
I know there is a outputcsv option to export it as csv on splunk file system. And I know also that I can click in the web interface UI on the "export" button to export it as csv, but both is not what I need.

I need a similar solution as the "export button"-solution, to download the csv file from the browser, but i need it without the need of clicking the "export" button. I want to create a direct http-link, which on opening the link in a browser downloads the csv file directly (open the save as browser dialog), without needed user interaction in web-interface.

So it is possible to manipulate the http-splunk-link or with some custom options in the splunk search, to produce direct csv-file download links?

As result I want to have a solution to produce http links, which when opened in a browser, switch to the "save as" dialogue (after some time splunk needed to calculate the results), because the link should tell splunk to process the search and then send the file automatically to the requested browser.

I need that for automation purpose to get a simple solution to read splunk search results in other tools and work with that data. For that, I think a simple solution would be splunk direct csv file result download links. So I hope splunk support that.

Thanks a lot
S.

0 Karma

c_krishna_gutur
Explorer

Hi.. Looking for exact requirement to download the report instead of clicking. Did you get any clue how to do it?Please let me know

0 Karma

thomrs
Communicator

You should be abel to use the JavaScript SDK to build what you need, there are some great examples to get you started. I myself use the Python SDK with an AngualrJS front end. I'm sure I can do what you are asking with that. I don't do a download put do stream csv results into a template very similar process.

http://dev.splunk.com/view/sdks/SP-CAAADP7

0 Karma

schece
New Member

Thank you! As I described with some more details in the answer of "gpradeepkumarreddy": It's for automation for proceeding splunk-result-data in excel. And it's already done in VBA in Excel, only thing I need is that splunk is sending the result as csv-file on http-link opening, because my actual Excel VBA script is working with a http-link, which needs a csv-file as download. I think I don't want to program a bigger framework to get the csv-file. I think then I better stick to the idea of "gpradeepkumarreddy" and use Splunk REST API calls and try to proceed the result data directly in Excel VBA.

0 Karma

pradeepkumarg
Influencer

You might want to explore Splunk Rest API to get data from Splunk search results into other tools
http://docs.splunk.com/Documentation/Splunk/6.2.1/RESTUM/RESTusing

schece
New Member

Good idea with REST API, perhaps I will give it a try.

But at the moment the application in which I want to work with the splunk search data and automate the process in it, is Excel. And i have already created a script in VBA to open HTTP-links which return a *.csv file and to work this in my excel file. So if someone know a direct solution for a direct csv-file donwload with a direct link, would be a bit better for my situation. Because the VBA code for that is already finished.

But never the less, your idea is really good! So if I didn't get a solution for my first idea, I will give it a try with a Rest API. Perhaps someone has a example for Excel with VBA, which is working with the SPLUNK Rest API and proceed with the splunk-REST-API-data in Excel already. That would be nice! (But perhaps I should open a new thread for this)

Thanks a lot!

0 Karma
Register for .conf21 Now! Go Vegas or Go Virtual!

How will you .conf21? You decide! Go in-person in Las Vegas, 10/18-10/21, or go online with .conf21 Virtual, 10/19-10/20.