Text and number input
Text
Use text inputs to let dashboard users pass any number or string to the input.
The following example dashboard has 2 text inputs: Input URI path and Input hex color. The token value from Input URI path, $uri_path$, is used in the titles and data sources for both visualizations. The token value from Input hex color, $hex$, is used to color the table header row and the single value visualization background.
Expand this window to copy and paste the dashboard definition for this example into your own dashboard.
{
"title": "Example — Text Input",
"description": "Two text input examples shown changing SPL query, titles, coloring. ",
"inputs": {
"input1": {
"options": {
"defaultValue": "/services/data/inputs/monitor",
"token": "uri_path"
},
"title": "Input URI path:",
"type": "input.text"
},
"input2": {
"options": {
"defaultValue": "#9964F1",
"token": "hex"
},
"title": "Input hex color:",
"type": "input.text"
}
},
"defaults": {
"dataSources": {}
},
"visualizations": {
"viz_1oEXTiEw": {
"options": {
"fill": "#708794",
"rx": 4,
"stroke": "transparent"
},
"type": "splunk.rectangle"
},
"viz_AC5HOg5v": {
"options": {
"fill": "#ffffff",
"fillColor": "#ffffff",
"rx": 4,
"stroke": "transparent"
},
"type": "splunk.rectangle"
},
"viz_F79EMhfz": {
"options": {
"customFontSize": 50,
"fontSize": "custom",
"markdown": "**Text Input**"
},
"type": "splunk.markdown"
},
"viz_NGyZFGd1": {
"options": {
"markdown": "Values shown are filtered for URI paths based on the value entered in the **Input URI path** text input.\n\nThe color of the header row is based on the value entered in the **Input hex color** text input."
},
"type": "splunk.markdown"
},
"viz_R8trLpwN": {
"dataSources": {
"primary": "ds_irmYUrt0"
},
"description": "",
"options": {
"backgroundColor": "transparent",
"headerTextColor": "#000000",
"rowBackgroundColorOdd": "#ffffff",
"rowNumbers": true,
"rowTextColorEven": "#294e70",
"rowTextColorOdd": "#000000",
"tableFormat": {
"headerBackgroundColor": "$hex$",
"headerColor": "#ffffff"
}
},
"title": "Internal Access Logs by URI Path ($uri_path$)",
"type": "splunk.table"
},
"viz_Xgrs9smW": {
"options": {
"fill": "#708794",
"rx": 4,
"stroke": "transparent"
},
"type": "splunk.rectangle"
},
"viz_Y65W1GWv": {
"options": {
"markdown": "Text inputs allow users to enter values that can be used throughout the dashboard, such as in titles, descriptions, and data sources."
},
"type": "splunk.markdown"
},
"viz_ii6DfRcA": {
"options": {
"markdown": "### Dynamic Table Based on Text Inputs"
},
"type": "splunk.markdown"
},
"viz_mz81M1yZ": {
"containerOptions": {
"title": {
"color": "#ffffff"
}
},
"dataSources": {
"primary": "ds_66qMp7TI"
},
"description": "",
"options": {
"backgroundColor": "$hex$",
"headerColor": "white",
"majorColor": "#ffffff"
},
"title": "Internal Access Attempt Count for $uri_path$",
"type": "splunk.singlevalue"
},
"viz_oXAXDETA": {
"options": {
"fill": "#ffffff",
"fillColor": "#ffffff",
"rx": 4,
"stroke": "transparent"
},
"type": "splunk.rectangle"
},
"viz_t1lGHoGc": {
"options": {
"markdown": "### Dynamic Single Value Based on Text Inputs"
},
"type": "splunk.markdown"
}
},
"dataSources": {
"ds_66qMp7TI": {
"name": "Single Value",
"options": {
"extend": "ds_BIdQZ95d",
"query": "| where uri_path=\"$uri_path$\"\n| stats count"
},
"type": "ds.chain"
},
"ds_BIdQZ95d": {
"name": "Base search - create data",
"options": {
"query": "| makeresults count=50 \n| eval _time = now() - random() % (3600 * 24 * 7) \n| streamstats count as event_id \n| eval \n source = case(\n event_id % 3 == 0, \"/var/log/splunk/splunkd_access.log\",\n event_id % 3 == 1, \"/opt/splunk/var/log/http_access.log\",\n true(), \"/var/log/apache2/access.log\"\n ),\n sourcetype = case(\n event_id % 2 == 0, \"splunkd_access\",\n true(), \"access_combined\"\n ),\n status = case(\n event_id % 7 == 0, \"200\",\n event_id % 7 == 1, \"404\",\n event_id % 7 == 2, \"500\",\n event_id % 7 == 3, \"302\",\n event_id % 7 == 4, \"401\",\n event_id % 7 == 5, \"200\",\n true(), \"200\"\n ),\n method = case(\n event_id % 4 == 0, \"GET\",\n event_id % 4 == 1, \"POST\",\n event_id % 4 == 2, \"PUT\",\n true(), \"DELETE\"\n ),\n uri_path = case(\n event_id % 5 == 0, \"/services/data/inputs/monitor\",\n event_id % 5 == 1, \"/en-US/app/search/flashtimeline\",\n event_id % 5 == 2, \"/en-US/app/launcher/home\",\n event_id % 5 == 3, \"/services/licenser/usage\",\n true(), \"/en-US/app/search/eventviewer\"\n )"
},
"type": "ds.search"
},
"ds_irmYUrt0": {
"name": "Table",
"options": {
"extend": "ds_BIdQZ95d",
"query": "| where uri_path=\"$uri_path$\"\n| table _time, source, sourcetype, status, method, uri_path\n| sort - _time"
},
"type": "ds.chain"
}
},
"layout": {
"globalInputs": [
"input1"
],
"layoutDefinitions": {
"layout_1": {
"options": {
"backgroundColor": "#ffffff",
"display": "auto-scale",
"height": 700,
"width": 1500
},
"structure": [
{
"item": "viz_1oEXTiEw",
"position": {
"h": 470,
"w": 510,
"x": 770,
"y": 130
},
"type": "block"
},
{
"item": "viz_Xgrs9smW",
"position": {
"h": 470,
"w": 710,
"x": 30,
"y": 130
},
"type": "block"
},
{
"item": "viz_AC5HOg5v",
"position": {
"h": 380,
"w": 470,
"x": 790,
"y": 180
},
"type": "block"
},
{
"item": "viz_oXAXDETA",
"position": {
"h": 380,
"w": 670,
"x": 50,
"y": 180
},
"type": "block"
},
{
"item": "viz_mz81M1yZ",
"position": {
"h": 240,
"w": 430,
"x": 810,
"y": 240
},
"type": "block"
},
{
"item": "viz_R8trLpwN",
"position": {
"h": 300,
"w": 630,
"x": 70,
"y": 260
},
"type": "block"
},
{
"item": "viz_Y65W1GWv",
"position": {
"h": 30,
"w": 890,
"x": 30,
"y": 90
},
"type": "block"
},
{
"item": "viz_F79EMhfz",
"position": {
"h": 50,
"w": 780,
"x": 30,
"y": 30
},
"type": "block"
},
{
"item": "viz_NGyZFGd1",
"position": {
"h": 60,
"w": 780,
"x": 70,
"y": 200
},
"type": "block"
},
{
"item": "viz_ii6DfRcA",
"position": {
"h": 60,
"w": 780,
"x": 50,
"y": 140
},
"type": "block"
},
{
"item": "viz_t1lGHoGc",
"position": {
"h": 60,
"w": 780,
"x": 790,
"y": 140
},
"type": "block"
},
{
"item": "input2",
"position": {
"h": 82,
"w": 198,
"x": 1080,
"y": 30
},
"type": "input"
}
],
"type": "absolute"
}
},
"options": {
"showTitleAndDescription": false
},
"tabs": {
"items": [
{
"label": "Text inputs example",
"layoutId": "layout_1"
}
]
}
}
}Number
Use number inputs to let dashboard users pass only a number to the input. This can be particularly useful when you want to pass a token to a search that can only take a numerical argument. Number inputs support decimals and negative numbers.
You can configure the following options for a number input under Value in the Configuration panel:
| Option | Description |
|---|---|
| Min | Set the lowest number the user can select. |
| Max | Set the highest number the user can select. |
| Step | Controls the interval when using the up and down arrows. For example, if you configure Step as 2 and the default value is 0, selecting the up arrow sets the value to 2, and selecting the down arrow sets the value to -2. |
The following example dashboard has a number input: Maximum table rows. The token value from Maximum table rows, $maximum_rows$, is used in the title and data source for the visualization.
Expand this window to copy/paste the dashboard definition into your own dashboard.
{
"title": "Example — Number Input",
"description": "Number input example shown changing SPL query, titles. ",
"inputs": {
"input_6k0vKgtK": {
"options": {
"defaultValue": 10,
"min": 0,
"step": 1,
"token": "maximum_rows"
},
"title": "Maximum table rows:",
"type": "input.number"
}
},
"defaults": {
"dataSources": {}
},
"visualizations": {
"viz_F79EMhfz": {
"options": {
"customFontSize": 50,
"fontSize": "custom",
"markdown": "**Number Input**"
},
"type": "splunk.markdown"
},
"viz_NGyZFGd1": {
"options": {
"markdown": "The number of values that the table shows is based on the value entered in the **Maximum table rows** number input."
},
"type": "splunk.markdown"
},
"viz_R8trLpwN": {
"dataSources": {
"primary": "ds_irmYUrt0"
},
"description": "",
"options": {
"backgroundColor": "transparent",
"columnFormat": {
"method": {
"width": 60
},
"source": {
"width": 60
},
"sourcetype": {
"width": 60
},
"status": {
"width": 60
}
},
"headerTextColor": "#000000",
"rowBackgroundColorOdd": "#ffffff",
"rowNumbers": true,
"rowTextColorEven": "#294e70",
"rowTextColorOdd": "#000000"
},
"title": "Internal Access Logs (Top $maximum_rows$ Results)",
"type": "splunk.table"
},
"viz_Xgrs9smW": {
"options": {
"fill": "#708794",
"rx": 4,
"stroke": "transparent"
},
"type": "splunk.rectangle"
},
"viz_Y65W1GWv": {
"options": {
"markdown": "Number inputs allow users to enter values that can be used throughout the dashboard, such as in titles, descriptions, and data sources."
},
"type": "splunk.markdown"
},
"viz_ii6DfRcA": {
"options": {
"markdown": "### Dynamic Table Based on Number Inputs"
},
"type": "splunk.markdown"
},
"viz_oXAXDETA": {
"options": {
"fill": "#ffffff",
"fillColor": "#ffffff",
"rx": 4,
"stroke": "transparent"
},
"type": "splunk.rectangle"
}
},
"dataSources": {
"ds_BIdQZ95d": {
"name": "Base search - create data",
"options": {
"query": "| makeresults count=50 \n| eval _time = now() - random() % (3600 * 24 * 7) \n| streamstats count as event_id \n| eval \n source = case(\n event_id % 3 == 0, \"/var/log/splunk/splunkd_access.log\",\n event_id % 3 == 1, \"/opt/splunk/var/log/http_access.log\",\n true(), \"/var/log/apache2/access.log\"\n ),\n sourcetype = case(\n event_id % 2 == 0, \"splunkd_access\",\n true(), \"access_combined\"\n ),\n status = case(\n event_id % 7 == 0, \"200\",\n event_id % 7 == 1, \"404\",\n event_id % 7 == 2, \"500\",\n event_id % 7 == 3, \"302\",\n event_id % 7 == 4, \"401\",\n event_id % 7 == 5, \"200\",\n true(), \"200\"\n ),\n method = case(\n event_id % 4 == 0, \"GET\",\n event_id % 4 == 1, \"POST\",\n event_id % 4 == 2, \"PUT\",\n true(), \"DELETE\"\n ),\n uri_path = case(\n event_id % 5 == 0, \"/services/data/inputs/monitor\",\n event_id % 5 == 1, \"/en-US/app/search/flashtimeline\",\n event_id % 5 == 2, \"/en-US/app/launcher/home\",\n event_id % 5 == 3, \"/services/licenser/usage\",\n true(), \"/en-US/app/search/eventviewer\"\n )"
},
"type": "ds.search"
},
"ds_irmYUrt0": {
"name": "Table",
"options": {
"extend": "ds_BIdQZ95d",
"query": "| table _time, source, sourcetype, status, method, uri_path\n| sort - _time\n| head $maximum_rows$"
},
"type": "ds.chain"
}
},
"layout": {
"globalInputs": [
"input_6k0vKgtK"
],
"layoutDefinitions": {
"layout_1": {
"options": {
"backgroundColor": "#ffffff",
"display": "auto-scale",
"height": 700,
"width": 1500
},
"structure": [
{
"item": "viz_Xgrs9smW",
"position": {
"h": 550,
"w": 1220,
"x": 30,
"y": 130
},
"type": "block"
},
{
"item": "viz_oXAXDETA",
"position": {
"h": 480,
"w": 1160,
"x": 50,
"y": 180
},
"type": "block"
},
{
"item": "viz_R8trLpwN",
"position": {
"h": 280,
"w": 1100,
"x": 70,
"y": 240
},
"type": "block"
},
{
"item": "viz_Y65W1GWv",
"position": {
"h": 30,
"w": 890,
"x": 30,
"y": 90
},
"type": "block"
},
{
"item": "viz_F79EMhfz",
"position": {
"h": 50,
"w": 780,
"x": 30,
"y": 30
},
"type": "block"
},
{
"item": "viz_NGyZFGd1",
"position": {
"h": 20,
"w": 780,
"x": 70,
"y": 200
},
"type": "block"
},
{
"item": "viz_ii6DfRcA",
"position": {
"h": 60,
"w": 780,
"x": 50,
"y": 140
},
"type": "block"
}
],
"type": "absolute"
}
},
"options": {
"showTitleAndDescription": false
},
"tabs": {
"items": [
{
"label": "Number inputs example",
"layoutId": "layout_1"
}
]
}
}
}