Dashboards & Visualizations

Django(HTML)で作成したダッシュボードからCSV出力を行いたい

pisc
Explorer

サーチバーで検索した結果を出力したものをCSV出力する方法を教えてください。

Django(HTML + JavaScript)にてAppを作成してダッシュボードを作成しました。
サーチバーに入力したものをテーブルビューで出力するシンプルなダッシュボードです。

Advanced XMLであればを使用して結果を出力するボタンを作成することが出来ますが、Django(html)では作成することは可能でしょうか。
イメージはデフォルトで付属しているSearch.appで検索後、「スマートモード」の左隣にあるボタン群のようなものです。

Advanced XMLは「?showsource=true」でソースを確認してもXMLしか表示されず、
ブラウザ付属の「ソースを表示」を使用しても検索前(ボタン群が表示されていない)のソースしか表示されません。

以上、よろしくお願いします。

0 Karma

bananaman
Path Finder

Hi,

I have got sample HTML code from our colleague.
Please see the github link he created.

https://gist.github.com/mgroves84/d2a4e8ac91e8b6a6e86c

Please add this page to within the /django/templates/ directory for your test.

Thank you.

0 Karma

gburgett_splunk
Splunk Employee
Splunk Employee

Under the covers the export button calls the /en-US/api/search/jobs//results?isDownload=true endpoint. I’ve included an example of the full call below. Also see the docs on the job results endpoint.

http://127.0.0.1:8000/en-US/api/search/jobs/1395156402.45/results?isDownload=true&timeFormat=%25FT%2...

You would have to write some JS code to get the search_id from the search manager and then call the API endpoint to get the file.

I don’t have any sample code, but hopefully that will get you started.

0 Karma
Get Updates on the Splunk Community!

Build Scalable Security While Moving to Cloud - Guide From Clayton Homes

 Clayton Homes faced the increased challenge of strengthening their security posture as they went through ...

Mission Control | Explore the latest release of Splunk Mission Control (2.3)

We’re happy to announce the release of Mission Control 2.3 which includes several new and exciting features ...

Cloud Platform | Migrating your Splunk Cloud deployment to Python 3.7

Python 2.7, the last release of Python 2, reached End of Life back on January 1, 2020. As part of our larger ...