Skip to content

Instantly share code, notes, and snippets.

View hobbes3's full-sized avatar
😅

Satoshi Kawasaki hobbes3

😅
View GitHub Profile
@hobbes3
hobbes3 / datepicker.js
Last active August 29, 2015 14:01
format time datepicker oneshot
require([
'jquery',
'underscore',
'splunkjs/mvc',
// The ready! requirement makes sure the code below runs after Splunk initialize all the objects on the dashboards
// Without it the Javascript may try to act on a Splunk object that doesn't exist yet (like trying to hide a panel before the panel is created
'splunkjs/mvc/simplexml/ready!'
],
function(
$,
@hobbes3
hobbes3 / props.conf
Last active October 10, 2023 10:41
Example Splunk props + transforms
# 2014-05-11 12:34:11,372 INFO amec.foobar.com 148.23.14.242 | action = accept | status = 200 | bytes = 235 | method = GET | request = /store/checkout?q=foo&var=123#test | custom_var = some string with a "|" in it | another_var = !@#$1234
[my_sourcetype]
# index-time settings:
# http://regex101.com/r/fX9lB1
LINE_BREAKER = ([\r\n]+)\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} [A-Z]+
TRUNCATE = 1000
SHOULD_LINEMERGE = false
# http://regex101.com/r/lK9xB8
TIME_PREFIX = ^
@hobbes3
hobbes3 / move_inputs_to_panel_pre_61.js
Last active August 29, 2015 14:05
move inputs to panel pre 61
// Not needed in Splunk >= 6.1
// This function moves a list of input ids (jQuery format) to a panel
function move_inputs_to_panel(input_ids, panel_id) {
$(panel_id + " .panel-head").after('<div class="fieldset">');
$(panel_id + " .fieldset").append($(input_ids.join(", ")));
$(input_ids[0]).css("margin-left", "10px");
}
// Hide the first 2 fields
@hobbes3
hobbes3 / template.js
Last active August 29, 2015 14:05
splunkjs template js
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / total_results_count.js
Last active August 29, 2015 14:05
total results count table
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function(
$,
_,
mvc
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / multiselect_force_default.js
Last active August 1, 2019 01:29
multiselect force default select input
// TESTED in 7.3.x and 6.5.x (so should work in all other versions)
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
@hobbes3
hobbes3 / sticky.css
Last active August 29, 2015 14:05
sticky floating div inputs
#sticky.stick {
position: fixed;
top: 0;
z-index: 1000; /* Splunk modals are 1050 */
margin-top: 10px;
}
@hobbes3
hobbes3 / inpage_drilldown_pre_61.js
Last active August 29, 2015 14:05
inpage drilldown pre 61 tokens example
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
@hobbes3
hobbes3 / updating_viz_options.js
Last active September 10, 2015 21:43
updating viz options render
mvc.Components.get('my_chart').getVisualization(function(viz) {
viz.settings.set("charting.axisY.scale", "linear");
});