This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <form method="post" id="loginForm"> | |
| <div> | |
| <input type="text" name="username" placeholder="Username" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from utils import connect | |
| service = connect( | |
| app=os.getenv('SPLUNK_APP'), | |
| host=os.getenv('SPLUNK_HOST'), | |
| port=os.getenv('SPLUNK_PORT', 8089), | |
| token=os.getenv('SPLUNK_TOKEN'), | |
| username=os.getenv('SPLUNK_USERNAME'), | |
| password=os.getenv('SPLUNK_PASSWORD') | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [script:url_path] | |
| match = /api/v1/url_path | |
| script = url_path_handler.py | |
| scripttype = persist | |
| handler = url_path_handler.UrlPathHandler | |
| requireAuthentication = true | |
| output_modes = json | |
| passPayload = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as config from '@splunk/splunk-utils/config'; | |
| import { createRESTURL } from '@splunk/splunk-utils/url'; | |
| import { handleError, handleResponse } from '@splunk/splunk-utils/fetch'; | |
| ... | |
| const url = createRESTURL( | |
| 'storage/collections/data/mycollection/key', | |
| { app: config.app, sharing: 'app' } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import splunklib.client as client | |
| import splunklib.results as results | |
| service = client.connect( | |
| host=os.getenv('SPLUNK_HOST'), | |
| port=os.getenv('SPLUNK_PORT'), | |
| token=os.getenv('SPLUNK_TOKEN') | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function mapTypes(map) { | |
| return (obj) => { | |
| const newObj = {}; | |
| // eslint-disable-next-line no-restricted-syntax | |
| for (const key in obj) { | |
| if (Object.hasOwnProperty.call(obj, key)) { | |
| let value = obj[key]; | |
| const type = map[key]; | |
| switch (type) { | |
| case 'float': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| machines = ['mickey','mouse'] | |
| ports = [8000, 8089, 8088] | |
| # scans ports on the given machines and ports | |
| def scan_ports(machines, ports): | |
| for machine in machines: | |
| for port in ports: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| import PropTypes from 'prop-types'; | |
| const DashboardApiContext = React.createContext(); | |
| const DashboardApiProvider = ({ children }) => { | |
| const [api, setApi] = useState(); | |
| return ( | |
| <DashboardApiContext.Provider | |
| value={{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| import Table from '@splunk/visualizations/Table'; | |
| import { SplunkSearch } from '@splunk/datasources'; | |
| const DSTable = () => { | |
| const [dsResult, setDsResult] = useState(null); | |
| const ds = new SplunkSearch({ | |
| query: '| inputlookup example_kv', | |
| queryParameters: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { createStaticURL } from '@splunk/splunk-utils/url'; | |
| import $script from 'scriptjs'; | |
| function getLayoutApi(callback) { | |
| const url = createStaticURL('build/api/layout.js'); | |
| if (window.requirejs) { |