All Apps and Add-ons

How do you add a Python script to Splunk Enterprise?

mohan401
Engager

Hi All, I am using Splunk Web enterprise. I have created dashboards using UI and I have to do some operation on reports. Can any one please let me know where I have to write Python script and which APP/Add-on I have to plug-in to Splunk Web?
Thanks in Advance..

0 Karma

anjambha
Communicator

Hello Mohan,

You can refer below link..

https://docs.splunk.com/Documentation/Splunk/7.0.0/Admin/Commandsconf

http://dev.splunk.com/view/webframework-tutorials/SP-CAAAERK

Also you can refer below python splunk integration example...

Dashboard source (.xml) :

<dashboard script="refresh_button.js">
<label>Refresh Dashboard</label>
<row>
<panel>
<html>
<button id="refresh" type="button" class="btn" style="float: right;">Refresh
<i class="icon-rotate" style="font-size: 1em;"/>
</button>
</html>
</panel>
</row>
...

Commands.conf :
[refresh]
Filename = refresh.py

Refresh_button.js :
require([
"splunkjs/mvc",
"splunkjs/mvc/searchmanager",
"Jquery",
"splunkjs/mvc/simplexml/ready!"
], function(
mvc,
SearchManager
){
$('#refresh').on("click",function(){
var mySearch = new SearchManager({
id: "mysearch",
preview: true,
cache: true,
search: mvc.tokenSafe("| refresh "),
});
setTimeout("location.reload();", 0);
});
});

refresh.py :
import requests
import json
import csv
...

Get Updates on the Splunk Community!

How to send events & findings from AWS to Splunk using Amazon EventBridge

Amazon EventBridge is a serverless service that uses events to connect application components together, making ...

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...